ZK - Open Source Ajax Java FrameworkZK - Open Source Ajax Java Framework

How to execute JS function after component is initialized (DOM + databind + ZK JS)?

madruga0315Top Contributor
18 Mar 2010 19:51:50 GMT
18 Mar 2010 19:51:50 GMT

Hi,

My case is the following:

I have a grid with databind. After the grid is rendered, I want to call a JS function, that will iterate over the cells, do some processing, and update a label value. In my JS I get the reference of the widget with: zk.Widget.$('grid')

I'ts just a JS, I'm not creating a component neither extending a widget.

Is this possible somehow?

Thank you,
Madruga

PeterKuo
18 Mar 2010 20:37:17 GMT
18 Mar 2010 20:37:17 GMT

How about call Clients.evalJavaScript(command) in doAfterCompose()?
Please refer to
http://docs.zkoss.org/wiki/Applying_Input_Masks_With_JQuery

madruga0315Top Contributor
18 Mar 2010 21:50:49 GMT
18 Mar 2010 21:50:49 GMT

Hi Peter,

That didn't work.

What worked for me was using jq().ready() in my JS, like this:

jq(document).ready(function(){
    calculateTotalFooter(true);
});