asked
2014-09-12 12:55:20 +0800
adamian 15 ● 4 Hello there,
I've got a grid with more than 50 lines, with the mold set to default (i.e. scrolling) [1].
In every line there is a component that should have an event listener attached. (e.g. @Listen("onClick = button"))
The browser loads in the beginning only the first 50 lines (let's say 20 are visible at a time). If I scroll down, the client asks the server for more data. The server (Grid.java) loads and renders aditional data, but doesn't seem to post an onAfterRender event to my Composer. Is this normal? How can I now that there are new lines rendered so that I can attach event listeners to components?
I would like to avoid creating my RowRenderer.
One solution seems to be calling grid.renderAll() [2], for example in doAfterCompose. That way the wireEvents finds all the rows. Is there any other way?
1. http://zkfiddle.org/sample/2vah9aj/272-events-lost-for-grid-rows#source-2
2. http://zkfiddle.org/sample/2vah9aj/273-events-lost-for-grid-rows#source-2
onAfterRender: "Notifies one that the model's data has been rendered." - Not a very useful event when scrolling is involved, because you receive it only for the first 50 elements.
Created issue ticket here: http://tracker.zkoss.org/browse/ZK-2585 (ZK-2585)
I know what's the problem => the wiring is done in doAfterCompose(Comp comp) from your controller. Cause the buttons are not rendered they are not wired, so you should call technicly doAfterCompose again (or some subsection from it). I don't find a good way how to handle it exactly for the moment.
chillworld ( 2014-09-15 10:21:13 +0800 )editYeah, the wiring is done only for part of the buttons. If you scroll, the browser makes the server render other buttons, but I don't receive an onAfterRender event, to rewire the new buttons.Can this be classified as a bug?
adamian ( 2014-09-15 10:43:16 +0800 )editalways possible to create a bugreport, they have to look at it and they will give a solution or mark it as bug and solve it.
chillworld ( 2014-09-15 11:27:49 +0800 )editWhat version and package (CE or EE) of ZK are you using?
vincentjian ( 2015-01-13 06:18:59 +0800 )edit6.5.3, but you can test on zkfiddle (links above) on 7.0.3.
adamian ( 2015-01-13 07:24:05 +0800 )edit