You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Muhammad Gelbana <m....@gmail.com> on 2011/09/09 19:07:14 UTC

Run javascript after a zone is updated

I have a table with many cells being updated using ajax calls. In the
block returned by the ajax call, I conditionally run some java script
to style the td and div in which the response is rendered.

For a reason, this javascript isn't executed well. But I when I run
the returned script manually on friebug after the cell is rendered, It
causes the desired effect !!
May be the dom isn't ready for the script to run ? I'm confused !

-- 
Regards,
Muhammad Gelbana
Java Developer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Run javascript after a zone is updated

Posted by derkoe <ta...@gmail.com>.
Muhammad Gelbana wrote:
> 
> I solved the situation using a workaround. But I still couldn't
> efficiently run javascript when the block zone is updated.
> I tried using the javascriptsupport service but couldn't find a way to
> use it as it needs to be used in the "afterrender" event of the zone
> which i couldn't figure out where to implement !..mixins doesn't work
> with zones !!
> 
> If any of this sounds crazy..it's because I'm new to ajax with tapestry.
> 

In your AJAX event handler just add the script via JavaScriptSupport - this
script will be executed after the zone is updated:

onAjaxEvent()
{
  javaScriptSupport.addScript("alert('Hello')");
}


--
View this message in context: http://tapestry.1045711.n5.nabble.com/Run-javascript-after-a-zone-is-updated-tp4787067p4799165.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Run javascript after a zone is updated

Posted by Rendy Tapestry <re...@gmail.com>.
You could try this code, someone else was ask this question.

$('yourZoneId').observe(**Tapestry.ZONE_UPDATED_EVENT, function() {
       ...
});

On Tue, Sep 13, 2011 at 3:53 AM, Muhammad Gelbana <m....@gmail.com>wrote:

> I solved the situation using a workaround. But I still couldn't
> efficiently run javascript when the block zone is updated.
> I tried using the javascriptsupport service but couldn't find a way to
> use it as it needs to be used in the "afterrender" event of the zone
> which i couldn't figure out where to implement !..mixins doesn't work
> with zones !!
>
> If any of this sounds crazy..it's because I'm new to ajax with tapestry.
>
>
> On Mon, Sep 12, 2011 at 7:54 PM, derkoe
> <ta...@gmail.com> wrote:
> >
> > Muhammad Gelbana wrote:
> >>
> >> I have a table with many cells being updated using ajax calls. In the
> >> block returned by the ajax call, I conditionally run some java script
> >> to style the td and div in which the response is rendered.
> >>
> >> For a reason, this javascript isn't executed well. But I when I run
> >> the returned script manually on friebug after the cell is rendered, It
> >> causes the desired effect !!
> >> May be the dom isn't ready for the script to run ? I'm confused !
> >>
> >
> > I guest that's simply a JavaScript problem - did you solve it?
> >
> > Do you add the Script via JavaScriptSupport?
> >
> > --
> > Chris
> >
> >
> > --
> > View this message in context:
> http://tapestry.1045711.n5.nabble.com/Run-javascript-after-a-zone-is-updated-tp4787067p4795128.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
>
> --
> Regards,
> Muhammad Gelbana
> Java Developer
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Run javascript after a zone is updated

Posted by Muhammad Gelbana <m....@gmail.com>.
I solved the situation using a workaround. But I still couldn't
efficiently run javascript when the block zone is updated.
I tried using the javascriptsupport service but couldn't find a way to
use it as it needs to be used in the "afterrender" event of the zone
which i couldn't figure out where to implement !..mixins doesn't work
with zones !!

If any of this sounds crazy..it's because I'm new to ajax with tapestry.


On Mon, Sep 12, 2011 at 7:54 PM, derkoe
<ta...@gmail.com> wrote:
>
> Muhammad Gelbana wrote:
>>
>> I have a table with many cells being updated using ajax calls. In the
>> block returned by the ajax call, I conditionally run some java script
>> to style the td and div in which the response is rendered.
>>
>> For a reason, this javascript isn't executed well. But I when I run
>> the returned script manually on friebug after the cell is rendered, It
>> causes the desired effect !!
>> May be the dom isn't ready for the script to run ? I'm confused !
>>
>
> I guest that's simply a JavaScript problem - did you solve it?
>
> Do you add the Script via JavaScriptSupport?
>
> --
> Chris
>
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Run-javascript-after-a-zone-is-updated-tp4787067p4795128.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Regards,
Muhammad Gelbana
Java Developer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Run javascript after a zone is updated

Posted by derkoe <ta...@gmail.com>.
Muhammad Gelbana wrote:
> 
> I have a table with many cells being updated using ajax calls. In the
> block returned by the ajax call, I conditionally run some java script
> to style the td and div in which the response is rendered.
> 
> For a reason, this javascript isn't executed well. But I when I run
> the returned script manually on friebug after the cell is rendered, It
> causes the desired effect !!
> May be the dom isn't ready for the script to run ? I'm confused !
> 

I guest that's simply a JavaScript problem - did you solve it? 

Do you add the Script via JavaScriptSupport?

-- 
Chris


--
View this message in context: http://tapestry.1045711.n5.nabble.com/Run-javascript-after-a-zone-is-updated-tp4787067p4795128.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org