Execute code after Spry region redrawn / added to DOM
Hi,
I'm integrating my Spry event data with a YUI calendar.
Everything is working and event dates are highlighted on the YUI calendar. There is one last thing I wish to do which is to update the YUI calendar with a Spry Tooltip. The div regions for the tooltip text are generated dynamically by via a Spry repeating region. What I am failing to do is attach the tooltips to the YUI calendar after the Spry repeating region has been added to the docuement DOM. So the Spry Tooltip function cannot find the ID of the tooltips.
I have a dataset observer "onpostload" which seems to fire when the data is loaded but before the document dom has been updated by Spry. How can I ensure I wait for Spry to update the region and hence DOM with the new data before triggering the tooltip code?
Cheers
Phil
You got different kind of observers in Spry Data.
- Dataset observers:
datasetname.addObserver( observer )
- Spry Region Observers:
Spry.Data.Region.addObserver( 'region-id', observer );
The dataset observers send out notifications when there is a event happening inside the Spry Data Sets. The one you mentioned is part of this (onPostLoad). These are great to monitor your data changes, but in your case. You don't want to use these.
The Spry region observers respond to events that are happening in side the region. For example onPreUpdate, this event is called when the region is about to generate / insert new markup in to your region. But you also got the onPostUpdate. This is the observer you are looking for, it gets called once the region has re-generated its code / html. It gets fired directly after the new HTML has been inserted.
Small note about the region observers, these require a id= attribute. This id attribute must be placed on the same element as the spry:region. To learn, and read more about the observers i would like to referrer you to this article:
Data Set and Region Overview
Its rather large, but using the browser build in find function you should be able to locate the sections about the observers
Hopes this helps,
Similar Messages
-
Execute code after show() in a Modal JDialog
Is there any way of executing a piece of code after a Modal JDialog's show() method ? I tried to run the code using SwingUtilities.invokeLater to no use. Any ideas ?
Thanks !Thanks Jamie !
Adding a new thread wasn't required. I found the solution in some forum. The main issue was to get focus to a textfield in JDialog along with displaying a JPopupMenu against it. I could get the focus in but the popup wasn't showing. In brief this is what solved it.
Assuming JTextField is testField. I add this listener to the textField just before calling JDialog.show().
<code>
private FocusListener fListen = new FocusListener()
public void focusGained(FocusEvent e)
// showPop() logic
public void focusLost(FocusEvent e)
testField.removeFocusListener(fListen);
testField.requestFocus();
</code> -
How to execute code after JSF startup?
Hello,
I need to execute some initialization code after JSF startup, so I cannot do the usual ServletContextListener trick, as that runs before JSF is completely initialized. Any ideas?
Kind regards,
UlrichI can think of one way to do this (which might be a bit cumbersome for what you are trying to do) : use the Spring framework's web integration classes.
You can specifiy a context listener in your web.xml :
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
That way, Spring will load an ApplicationContext, and in that context you can specify a Spring bean that will be instantiated at application startup, which will perform whatever logic you need to do.
More info here :
http://static.springframework.org/spring/docs/2.0.x/reference/webintegration.html -
Adf valueChangeListener autosubmit=true, execute code after update model
Hello.
I'm working with the valueChangeListener and autosubmit="true". I'll try to explain my situation
with an example.
jsp:
<af:form>
<af:panelForm>
<af:inputText
id="value1"
label="Value1"
value="#{index.myObject.value1}"
autoSubmit="true"
valueChangeListener="#{index.changeListener1}"/>
<af:inputText
id="value2"
label="Value2"
value="#{index.myObject.value2}"/>
</af:panelForm>
</af:form>
backing:
public class Index {
private MyObject myObject;
public Index() {
myObject = new MyObject();
public void changeListener1(ValueChangeEvent valueChangeEvent){
doSomethingWithMyObject(myObject);
// ... get/set of myObject
MyObject:
public class MyObject {
private String value1;
private String value2;
public MyObject() {}
//getters/setters...
}In the line doSomethingWithMyObject(myObject) i need myObject with the actual values in the user form.
in the example above, the first time the page is rendered and shows the inputs
if the user captures something in the 1st input and then hits the tab to go to the other input
the valueChangeEvent is fired, and the code in "index.changeListener1" executed, but at this moment
the model (myObject) hasn't been updated with the data that the user entered (Validation Phase).
So i need a way to execute my code called from the "valueChangeEvent" but after the model has been updated
Some notes about my problem:
- The doSomethingWithMyObject(myObject) could update data in myObject
- About binding="#{x.y}":
I know i can use the binding attribute in the tag <af:inputText binding="#{x.y}"> and then in the code of
the changelistener the binded component always have the most recent value from the user,
but i cant' use that, the method needs a MyObject instance.
- I don't think create a new instance of MyObject and populate it every time the event fires is a good way
- doSomethingWithMyObject" is a black box, so i don't know what is going to do with myObject
- In my problem there are more than 2 inputs there will be N components M listeners.
What I'm trying:
PhaseListener:
I have been implementing a solution with a PhaseListener like
public void afterPhase(PhaseEvent phaseEvent) {
// just after UPDATE_MODEL_VALUES phase
FacesContext f = FacesContext.getCurrentInstance();
Index i = (Index) f.getApplication().createValueBinding("#{index}").getValue(f);
// at this point the model is updated
doSomethingWithMyObject(i.getMyObject);
public PhaseId getPhaseId() {
return PhaseId.UPDATE_MODEL_VALUES;
this works but i don't know if this is the answer according to this post (unanswered at this time):
http://forums.oracle.com/forums/thread.jspa?threadID=611643
says something about that PhaseListener is not thread safe and blocks the application with more
than 1 user.
A wrapper:
using the controls binded to the backing
public class Index {
private MyObject myObject;
private CoreInputText inputValue1;
private CoreInputText inputValue2;
//listener
//getters/setters
} make a wraper like
public class MyObjectW {
private Index index; // wrap the backing index
public MyObjectW(Index index) {
this.index = index;
public String getValue1(){
return (String) index.getInputValue1().getValue();
public String getValue2(){
return (String) index.getInputValue2().getValue();
public void setValue1(Object v){
index.getInputValue1().setValue(v);
public void setValue2(Object v){
index.getInputValue2().setValue(v);
}and then call in the index backing:
doSomethingWithMyObject( new MyObjectW(this)); so it will access to the most actual values from user at the valueChangeEvent
But i really would like some way to execute my code called from the "valueChangeEvent" but after the model has been updated
so i dont need to wrap or implement PhaseListener
what do you think, what do you suggest, have any solution or a way to do what I'm trying?
thank you for your help...
Message was edited by:
akanewstedHello Frank, thanks for the response.
When you say
"If you need an updated object in this listener then you can update it from the value change listener as well"
you mean i can update the object by myself with the value from getNewValue()? or is there another way
to call to update the models at this time ?
I know i have the methods "getOldValue()" and "getNewValue()" in the "ValueChangeEvent" but what if i need
the actual value from the user in other control than the one that fires the event
example
Two inputs:
in the input1 the user enters some data
in the input2 when some data is entered it fires valueChangeListener (autosubmit=true)
in that case what if i need the value the user just entered in the input1 in the valueChangeListener of
the input2.
In general the app I'm working must do:
dynamically generate the controls in the form (inputs, selects etc)
Attach the control values to a model ( <af:inputText value=#{model.x}"/>
sometimes execute some script when a value change in a control (valueChangeListener)
those scripts uses the model (and needs to be an updated model)
script = " if (value2 = 'xyz') then value1='abc'; return true;";
if the model is not updated
the script will use old values and will be wrong
or if the script change some value in the model, when the update model phase occurs the value from
the script is lost.
that's why i need to work directly with the model and not the values in the ValueChangeEvent
Is there a way to use something like an action in the change of a control value?
that way the code will execute in the invoke application phase, can this be done ?
how i can execute code in the invoke application when a valueChangeEvent occurs ?
hope this help to explain more my situation.
Thank you for your help and time. -
Executing code after a transition has finished
Hi,
Is there any kind of language construct in JavaFX to allow a certain block of code to be executed after a transition has finished? Or do I have to pause the current thread with sleep() or similar?
The ideal would be something like this, but of course such a thing like onComplete does not exist AFAIK:
FadeTransition {node: selectedNode duration: 1s fromValue: 1 toValue: 0 onComplete: executeThis()}.play();Hello,
By "delete node" you mean delete it from scene? This example works for me:
var stage: Stage = Stage {
width: 250
height: 250
scene: Scene {
content: [
text = Text {
layoutY: 30
opacity: 0.0
content: "Example transition"
Button {
layoutY: 70
text: "Click me"
action: function() {
FadeTransition {
node: text
fromValue: 0.0
toValue: 1.0
duration: 200ms
action: function() {
delete text from stage.scene.content;
}.play();
}Saa -
Executing code when a listener is added
Is there a way for an event generater to execute certain code whenever an event listener registers with it? If so, where would you have to put this code?
You write the appropiate support class for listeners to this event, that is, the class which handlers add<Something>Listener, and register only an instance of this class as a listener of the original event. In the add<Something>Listener, before adding the object in the listeners list, you execute the code you wish.
If this doesn't seem as an appropiate solution, will you please provide some more details? The topic is interesting, thanks. -
Dreamweaver rewriting spry:region
When I save a template that contains a Spry dataset and
region, Dreamweaver changes the region to "datasetname function".
When the template loads the code is:
spry:region="dsAirsale"
when I save the file, it becomes:
spry:region="dsAirsale function"
Why?I've never seen/heard of this problem. Do you have a sample
file we can look at to reproduce the problem? Are you talking about
saving the .dwt file? Or an HTML file that is an instance of the
template? Is the spry:region inside an editable region?
--== Kin ==-- -
I'm trying to add a region.addobserver and addEventListener to spry regions so the links; that come for a external feed, opens in a new(default browser) window when clicked. The on* events in regions do not work in AIR so, is there a way to do this?
I have read a lot of the documentation on spry regions, addObserver and the addEventlistener but the samples don't deal with anything about external xml feeds with links in a spry region for a AIR app.
The closiest i saw was the gallery http://labs.adobe.com/technologies/spry/articles/air/photo_gallery.html, but it doesn't deal with:
links,
in a external RSS feed,
in the spry region,
to a new default browser.
Has anybody tried this before? Can it be done?
Ex:
<div spry:region="rssDataNews" class="SpryHiddenRegion">
<div spry:state="loading" id="notification2">Loading feeds, please wait ...<img src="assets/spinner.gif"></div>
<div spry:state="error">Failed to load data! Please try again later</div>
<table width="100%" spry:state="ready">
<tr spry:repeat="rssDataNews" class="{ds_EvenOddRow}" spry:select="mySelectClass">
<td class="cellPad">
<span style="font-weight:bold">{title}</span><br /><br />
{description}<br />
<a href="{link}" target="_blank">[Read full article]</a><br /><br />
</td>
</tr>
</table>
<div>
The <a href > only opens the url in the native AIR window. I need it to open in a web browser.
Message was edited by: dee12345654321About on* events
They do work, but not as attribute on your HTML elements, you will need to use eventlisteners to attach them on the relevant nodes.
How: http://labs.adobe.com/technologies/spry/samples/dom_utils/add_event_listener.html
About links
Currently in Adobe AIR, its not (easily) possible to open or execute other programs on the users PC. I have seen die hard hacker user Java to get around this limitation. But i suggest you check out the Adobe AIR forum to confirm that you cant open links in the users browser.
But, Adobe AIR is basically a browser -
I am currently in Cameroon, Africa and after arriving here, I added Global services to my plan in hopes to be able to use my phone to call local numbers. When I dial local numbers in Cameroon, with or without the country code, the call fails. I suspect it may be that the phone is 3G and this area only supports 2G. Help!
cctga,
We appreciate you taking the time to reach out to us. I am sorry to hear that you are having trouble while traveling. We definitely want to make sure you have all available options. Normally when traveling internationally we reccommend setting up international services prior to leaving. When you added the services did you do so online or with a rep? It would be best to contact our global department in order to troubleshoot any and all issues with services while international http://vz.to/17KseUf.
Thank you,
TonyG_VZW
Follow us on Twitter @VZWSupport -
HT2397 can i change the regional code after it has misstakenly been changed to a permanent ?
i cant change my regional (DVD) code after i misstakenly have changed the code !!!! can someone please help me ?
After five changes the player is locked on the last one. You would have to replace the drive with another one.
Ciao. -
Hi experts,
I'd like to execute some Java code after a successful login. I guess I could write a custom login module or use a WD Java iView to do this but a "better" solution may exist.
Regards,
PierreCustomizing your login module is probably your best bet. As soon as you're user is authenticated, you can execute your custom Java code.
From my experience, I have not seen an easier / cleaner way to capture that event.
Regards,
Tom -
How do I display on-the-fly generated XML on a web page using DW CS4 Spry regions?
On a main web page I'm trying to display formatted data from an ASP page that generates XML on-the-fly from a query.
When I run the ASP page from the browser, the XML formatting of the data works. But when I run the main web page, the data doesn't display.
I'm using DW CS4 Spry regionsto display the data on the main page from the XML data generated by the ASP page. Here's the main page code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache" >
<html>
<head>
<script type="text/javascript" src="SpryAssets/xpath.js"></script>
<script type="text/javascript" src="SpryAssets/SpryData.js"></script>
<script type="text/javascript" src="SpryAssets/SpryUtils.js"> </script>
<script type="text/javascript">var A1D1xml = new Spry.Data.XMLDataSet("A1D1ACRs_testWxmlCode.asp", "tests/test");</script>
<title>Test XML Main</title>
</head>
<body>
<div id="A1D1xml" spry:region="A1D1xml">
<table id="A1D1">
<tr>
<th>ID</th>
<th>Last Name</th>
<th>Final Status</th>
</tr>
<tr spry:repeat="A1D1xml">
<td>{acr_id}</td>
<td>{acr_lastName}</td>
<td>{acr_final_status}</td>
</tr>
</table>
</div>
</body>
</html>
Here's the code for the page that generates the XML: A1D1ACRs_testWxmlCode.asp
<html>
<%
set objConn=server.CreateObject("ADODB.Connection")
objConn.Open application("web_test")
set rs = objConn.Execute( "SELECT acr_id, acr_lastName, acr_final_status from acr_records_grid_view where acr_changeOption = 'A1D1'")
Response.ContentType = "text/xml"
Response.AddHeader "Pragma", "public"
Response.AddHeader "Cache-control", "private"
Response.AddHeader "Expires", "-1"
%>
<?xml version="1.0" encoding="utf-8"?>
<tests>
<%While (NOT rs.EOF)%>
<test>
<ID><%=(rs.Fields.Item("acr_id").Value)%></ID>
<acr_lastName><![CDATA[<%=(rs.Fields.Item("acr_lastName").Value)%>]]></acr_lastName>
<acr_final_status><![CDATA[<%=(rs.Fields.Item("acr_final_status").Value)%>]]></acr_final_s tatus>
</test>
<%
rs.MoveNext()
Wend
%>
</tests>
<%
rs.Close()
Set rs = Nothing
%>
</html>
Thanks.Thanks, but no; I'm using the correct case and folder.
With this code on the main page, The region flashes the table column header names
and the code as written for the spry repeat; then instantly disappears from the screen.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="SpryAssets/xpath.js"></script>
<script type="text/javascript" src="SpryAssets/SpryData.js"></script
<script type="text/javascript">var A1D1x = new Spry.Data.XMLDataSet("A1D1ACRs_testWxmlCode.xml", "tests/test");</script>
<title>Test XML Main</title>
</head>
<body>
<div id="A1D1" spry:region="A1D1x">
<table id="A1D1a">
<tr>
<th>ID</th>
<th>Last Name</th>
<th>Final Status</th>
</tr>
<tr spry:repeat="A1D1x">
<td>{acr_id}</td>
<td>{acr_lastName}</td>
<td>{acr_final_status}</td>
</tr>
</table>
</div>
</body>
</html> -
How can I execute program after using F4_Filename function?
Hi all,
I'm a new user on the forum. I've been working with ABAP and SAP for a few weeks. I wrote a program for importing data from excel file to SAP using BDC. During searching this forum I found information about F4_Filename function which allows users to browse the disc for a file. I'd like to add this function to my program. I have a parameter for a file name but this is an ordinary static string field. When I added the code which I found in the message on this forum the rest of program doesn't execute.
This is simple program for example:
REPORT Z_TEST8_AB.
DATA f_name TYPE STRING.
PARAMETERS p_file like rlgrap-filename DEFAULT 'c:\test.xls'.
f_name = p_file.
write:/ f_name.
This program works correctly. There is a field for parameter. I can change the default name for a file.
After all, I can run the program (F8) and rest of the code is executed. The field for parameter dissapears from the screen and the file name is displayed. ( command write)
Now I added a function F4_Filename
REPORT Z_TEST8_AB.
DATA f_name TYPE STRING.
PARAMETERS p_file like rlgrap-filename DEFAULT 'c:\test.xls'.
at selection-screen on value-request for p_file.
call function 'F4_FILENAME'
exporting
program_name = syst-repid
dynpro_number = syst-dynnr
field_name = 'p_file'
importing
file_name = p_file.
f_name = p_file.
write:/ f_name.
I can browse a computer for a file now but after selecting the file I can't run the rest of the code. When I click on the icon or press key F8 the field for parameter doesn't dissapier and the command write is not executed.
What do I do wrong?
Could anyone suggest me a solution? How can I executed the code after using this function?
Thanks in advance.
Regards,
Arek.Hi arkadiusz,
1. simple
2.
<b>start-of-selection.</b>
f_name = p_file.
write:/ f_name.
regards,
amit m. -
Hiding Columns in a Spry Region
Hello All,
I'm using the SpryDOMUtils.js to hide columns in my SPRY table. Everything works fine when I load the page except when I add the LoadListener to hide the columns when the page generates:
function hideColumn(){
Spry.$$("#second th:nth-child(n+5),#second td:nth-child(n+5)").toggleClassName("hideIt");
changeText("button2","Hide Detail","Show Detail");
Spry.Utils.addLoadListener(function(){
hideColumn();
After the page loads the columns are hidden like they are supposed to but the show button will not 'show' the columns and the code seems broken. Sorry I cannot post a link the code as it is on a Intranet.
I have followed the example on http://labs.adobe.com/technologies/spry/samples/dom_utils/hide_columns.html but maybe it is because it is in a spry region?
Cheers!
KevinI'm assuming that by "Spry Table" you meant that you are using a Spry region to generate a table. If so, you need to trigger your code from an onPostUpdate observer instead of triggering it after the page loads. The reason is that even though the page has loaded, the data sets that load your data still might not have completed loading ... so your region may not have been processed until *AFTER* the onload event fired.
Take a look at this example:
http://labs.adobe.com/technologies/spry/samples/data_region/RegionObserverSample.html
--== Kin ==-- -
Execute javascript after update and submit in Skillbuilders Modal Page
Hi,
I'm editing, say, list of my employees in a tabular form opened in Skillbuilders Modal Page.
I have to execute same javascript code after the changes in the tabular form have been submitted.
I've tried using a Dynamic Action fired on Page Load, but that gets executed before the update is completed.
Does anyone have an idea how to accomplish this?
Thank you!Thank you for your answers.
Yes, I'm trying to execute javascript code on the child page, the modal one.
Basically, there's a button on my parent page which opens the modal page. The modal page has buttons Cancel, Delete and Save. Clicking Save button submits the changes and if there are errors, errors are shown and we stay on the modal page.
My modal pages are all of fixed dimensions and if there are errors, I have to adjust the other regions (adjust their height, add a scrollbar, etc) in order to show everything in the modal page.
I have written a function that does exactly that, but I have to execute the function after the page is loaded and the regions are shown. But, if I execute it using onload attribute, or setting a dynamic action which fires on page load, the function gets executed during the submit, before the regions are shown.
I hope I have managed to clear up the problem.
As always, thank you.
Maybe you are looking for
-
my ipod touch screen is totally unresponsive and i have been using it under normal conditions. ihave tried the reset and restore but to no avail.everything works as it would normally do on the screen.help pls????
-
Hi all, In workflow i am able to attach the smartform in mail in .pdf format. But when i open the pdf from the mail, it give me an error saying "it was sent as an email attachment and wasn't correlty decoded". Kindly guide me what need to be done. Re
-
Script out SSIS packages from SSISDB using powershell
Hi, I was able to script out the packages that are on msdb but I was unable to script out that are in Integration services catalog. Does anyone has any idea on how to do this???? Is this possible at all??? Thanks in advance....
-
[Sorry for the last post with incomplete title] Hello everyone I am writing a program in Java that analyzes color patches from a colorimeter. Unfortunately, I am not quite sure how to use the related Java routines. That is, to read in the measuered d
-
How can I stop iTunes from transferring purchased apps from iPad to computer?
How can I stop iTunes from transferring purchased apps from iPad to my computer? I don't want them taking up space on my computer. iPad backups and apps on the cloud are enough to ensure my apps are backed up, so I don't understand why they need to b