0

onAfterRender not called after grid scrolling

asked 2014-09-12 12:55:20 +0800

adamian gravatar image adamian
15 4

updated 2015-01-13 07:26:54 +0800

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)

delete flag offensive retag edit

Comments

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 )edit

Yeah, 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 )edit

always 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 )edit

What version and package (CE or EE) of ZK are you using?

vincentjian ( 2015-01-13 06:18:59 +0800 )edit

6.5.3, but you can test on zkfiddle (links above) on 7.0.3.

adamian ( 2015-01-13 07:24:05 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-09-13 14:54:09 +0800

Darksu gravatar image Darksu
1991 1 4

Hello adamian,

The method you use, is the correct one for SelectorComposer. Else you could use the example that is provided in the following url:

http://www.zkoss.org/zkdemo/grid/paging

Best Regards,

Darksu

link publish delete flag offensive edit

Comments

Thanks. I'll wait a little while before marking as correct, maybe somebody else has another opinion/solution. I've used paging before you've mentioned it, in order not to send all the rendered data to the client and because I've found the solution with renderAll only after debugging.

adamian ( 2014-09-15 07:09:57 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2014-09-12 12:55:20 +0800

Seen: 32 times

Last updated: Jan 13 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More