Re: Calling javascript after asynchronous update
Would this also be the reason that I can't get an AjaxDirectLink to behave correctly if it was in an updated component? Unfortunately I am on Tap 4.0, so my fix may be more difficult if this is the case. Richard Hoberman wrote: Just a note to confirm that this does work with the 4.1.5 snapshot. Andreas Andreou wrote: Can you try it with a recent snapshot? http://people.apache.org/maven-snapshot-repository/org/apache/tapestry/tapestry-framework/4.1.5-SNAPSHOT/ I think someone mentioned that something like this now should work. A workaround is to have the script you want to execute already in the template and conditionally render it On Feb 5, 2008 1:20 PM, Richard Hoberman <[EMAIL PROTECTED]> wrote: Hi I'm using Tapestry 4.1.3. I'm trying unsuccessfully to invoke some javascript after an asyncrhonous update. I'll post code if needed, but here is the summary: 1. Simple page with a list. 2. Initialization javascript makes list sortable using script.aculo.us: Sortable.create('cityList', {only:'sortable', onUpdate: onCityListReordered }); 3. I have an EventListener that fires when the list is reordered 4. The list is asynchronously updated. So far so good. The problem is that after the update, the list items are no longer draggable. I'm assuming that this is because the replacement list needs to be re-initialized via Sortable.create. If this is right then I need to invoke some javascript after the update. I try adding the javascript from the event listener method: @EventListener( targets = { "cityList" }, events = { "onUpdate" } ) public void onItemsReordered(IRequestCycle cycle) { //updates cycle.getResponseBuilder().addInitializationScript(this, "...inline javascript..."); } This causes a NullPointerException because the DojoAjaxResponseBuilder has a null PageRenderSupportImpl (_prs). Am I approaching this the right way? Any pointers appreciated. Richard Hoberman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Calling javascript after asynchronous update
Just a note to confirm that this does work with the 4.1.5 snapshot. Andreas Andreou wrote: Can you try it with a recent snapshot? http://people.apache.org/maven-snapshot-repository/org/apache/tapestry/tapestry-framework/4.1.5-SNAPSHOT/ I think someone mentioned that something like this now should work. A workaround is to have the script you want to execute already in the template and conditionally render it On Feb 5, 2008 1:20 PM, Richard Hoberman <[EMAIL PROTECTED]> wrote: Hi I'm using Tapestry 4.1.3. I'm trying unsuccessfully to invoke some javascript after an asyncrhonous update. I'll post code if needed, but here is the summary: 1. Simple page with a list. 2. Initialization javascript makes list sortable using script.aculo.us: Sortable.create('cityList', {only:'sortable', onUpdate: onCityListReordered }); 3. I have an EventListener that fires when the list is reordered 4. The list is asynchronously updated. So far so good. The problem is that after the update, the list items are no longer draggable. I'm assuming that this is because the replacement list needs to be re-initialized via Sortable.create. If this is right then I need to invoke some javascript after the update. I try adding the javascript from the event listener method: @EventListener( targets = { "cityList" }, events = { "onUpdate" } ) public void onItemsReordered(IRequestCycle cycle) { //updates cycle.getResponseBuilder().addInitializationScript(this, "...inline javascript..."); } This causes a NullPointerException because the DojoAjaxResponseBuilder has a null PageRenderSupportImpl (_prs). Am I approaching this the right way? Any pointers appreciated. Richard Hoberman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Calling javascript after asynchronous update
Thanks, Andreas. The workaround works for me. I'll let you know how the snapshot turns out. Richard Andreas Andreou wrote: Can you try it with a recent snapshot? http://people.apache.org/maven-snapshot-repository/org/apache/tapestry/tapestry-framework/4.1.5-SNAPSHOT/ I think someone mentioned that something like this now should work. A workaround is to have the script you want to execute already in the template and conditionally render it On Feb 5, 2008 1:20 PM, Richard Hoberman <[EMAIL PROTECTED]> wrote: Hi I'm using Tapestry 4.1.3. I'm trying unsuccessfully to invoke some javascript after an asyncrhonous update. I'll post code if needed, but here is the summary: 1. Simple page with a list. 2. Initialization javascript makes list sortable using script.aculo.us: Sortable.create('cityList', {only:'sortable', onUpdate: onCityListReordered }); 3. I have an EventListener that fires when the list is reordered 4. The list is asynchronously updated. So far so good. The problem is that after the update, the list items are no longer draggable. I'm assuming that this is because the replacement list needs to be re-initialized via Sortable.create. If this is right then I need to invoke some javascript after the update. I try adding the javascript from the event listener method: @EventListener( targets = { "cityList" }, events = { "onUpdate" } ) public void onItemsReordered(IRequestCycle cycle) { //updates cycle.getResponseBuilder().addInitializationScript(this, "...inline javascript..."); } This causes a NullPointerException because the DojoAjaxResponseBuilder has a null PageRenderSupportImpl (_prs). Am I approaching this the right way? Any pointers appreciated. Richard Hoberman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Calling javascript after asynchronous update
Can you try it with a recent snapshot? http://people.apache.org/maven-snapshot-repository/org/apache/tapestry/tapestry-framework/4.1.5-SNAPSHOT/ I think someone mentioned that something like this now should work. A workaround is to have the script you want to execute already in the template and conditionally render it On Feb 5, 2008 1:20 PM, Richard Hoberman <[EMAIL PROTECTED]> wrote: > Hi > > I'm using Tapestry 4.1.3. > > I'm trying unsuccessfully to invoke some javascript after an > asyncrhonous update. I'll post code if needed, but here is the summary: > > 1. Simple page with a list. > 2. Initialization javascript makes list sortable using > script.aculo.us: Sortable.create('cityList', {only:'sortable', > onUpdate: onCityListReordered }); > 3. I have an EventListener that fires when the list is reordered > 4. The list is asynchronously updated. > > So far so good. > > The problem is that after the update, the list items are no longer > draggable. I'm assuming that this is because the replacement list needs > to be re-initialized via Sortable.create. If this is right then I need > to invoke some javascript after the update. > > I try adding the javascript from the event listener method: > > @EventListener( targets = { "cityList" }, events = { "onUpdate" } ) > public void onItemsReordered(IRequestCycle cycle) { > > //updates > > cycle.getResponseBuilder().addInitializationScript(this, "...inline > javascript..."); > > } > > This causes a NullPointerException because the DojoAjaxResponseBuilder > has a null PageRenderSupportImpl (_prs). > > Am I approaching this the right way? Any pointers appreciated. > > Richard Hoberman > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Andreas Andreou - [EMAIL PROTECTED] - http://blog.andyhot.gr Tapestry / Tacos developer Open Source / JEE Consulting - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]