You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Marc Salvetti <sa...@gmail.com> on 2005/11/16 11:01:45 UTC

execute js after row-delete ?

Hello,

I have a cart displaying an invoice on top of the page and a cforms with a
repeater displaying the products at the bottom of the page.
I need to update the invoice when a row is deleted in the repeater
The calculation of the invoice is done on the server and need to read from
the dom binded to the form
So i need to do a form.save(doc) to update the dom tree, then pass this dom
tree to the invoicing fonction.

Now my problem is that for the row-delete action, the on-action handler is
triggered *before* the row is removed, so calling form.save() in this
handler is useless for me.

Does someone now how to execute some code after the row is deleted ?

Thanks,

Marc

Re: execute js after row-delete ?

Posted by Marc Salvetti <sa...@gmail.com>.
Thanks a lot !
It works perfectly :)

Marc

2005/11/17, Robin Wyles <ro...@robinwyles.com>:
>
> Marc,
>
> Instead of using a fd:row-action why not use a fd:action such as:
>
> <fd:action id="delete_item" command="delete_item">
> <fd:on-action>
> <fd:javascript>
> var widget = event.source;
> var row = widget.parent;
> var repeater = row.parent;
> repeater.removeRow(repeater.indexOf(row));
> // Your extra code here...
> </fd:javascript>
> </fd:on-action>
> </fd:action>
>
> Hope this helps...
>
> Robin
>
>
> On 16 Nov 2005, at 11:01, Marc Salvetti wrote:
>
> > Hello,
> >
> > I have a cart displaying an invoice on top of the page and a cforms
> > with a repeater displaying the products at the bottom of the page.
> > I need to update the invoice when a row is deleted in the repeater
> > The calculation of the invoice is done on the server and need to read
> > from the dom binded to the form
> > So i need to do a form.save(doc) to update the dom tree, then pass
> > this dom tree to the invoicing fonction.
> >
> > Now my problem is that for the row-delete action, the on-action
> > handler is triggered *before* the row is removed, so calling
> > form.save() in this handler is useless for me.
> >
> > Does someone now how to execute some code after the row is deleted ?
> >
> > Thanks,
> >
> > Marc
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>

Re: execute js after row-delete ?

Posted by Robin Wyles <ro...@robinwyles.com>.
Marc,

Instead of using a fd:row-action why not use a fd:action such as:

<fd:action id="delete_item" command="delete_item">
	<fd:on-action>
		<fd:javascript>
			 var widget = event.source;
			 var row = widget.parent;
			 var repeater = row.parent;
			 repeater.removeRow(repeater.indexOf(row));
			 // Your extra code here...
		</fd:javascript>
	</fd:on-action>
</fd:action>

Hope this helps...

Robin


On 16 Nov 2005, at 11:01, Marc Salvetti wrote:

> Hello,
>
>  I have a cart displaying an invoice on top of the page and a cforms 
> with a repeater displaying the products at the bottom of the page.
>  I need to update the invoice when a row is deleted in the repeater
>  The calculation of the invoice is done on the server and need to read 
> from the dom binded to the form
>  So i need to do a form.save(doc) to update the dom tree, then pass 
> this dom tree to the invoicing fonction.
>
>  Now my problem is that for the row-delete action, the on-action 
> handler is triggered *before* the row is removed, so calling 
> form.save() in this handler is useless for me.
>
>  Does someone now how to execute some code after the row is deleted ?
>
>  Thanks,
>
>  Marc


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