0

Render On Demand ROD how to catch event onRender from listitem

asked 2017-07-06 08:03:40 +0800

eclipse2 gravatar image eclipse2
17 4

Hi!

I need to trigger one event listener, when one listitem finishes the rendering when using the Render On Demand on listbox. I was using the onAfterRender of the listbox, but when I access to last listitem loaded, they still do not have the value binded, because some elements haven't been loaded yet. There is anyway to do this?

Thanks, Regards, Jaime

delete flag offensive retag edit

Comments

Please provide a SIMPLE running example e.g. on http://zkfiddle.org/, your descriptions are a little vague to give a concrete answer.

cor3000 ( 2017-07-07 08:00:57 +0800 )edit

here it is: http://zkfiddle.org/sample/3kj2d8h/1-Listbox-ROD-trigger-event-of-new-page-rendered

eclipse2 ( 2017-07-07 09:52:58 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-07-07 09:55:56 +0800

eclipse2 gravatar image eclipse2
17 4

http://zkfiddle.org/sample/3kj2d8h/1-Listbox-ROD-trigger-event-of-new-page-rendered (Pratical example)

What I need is one simple way to trigger one event when one new page is loaded by ROD. Maybe I need to override some JS method, but I'm doing one custom component development, and for me it's acceptable do the trick.

link publish delete flag offensive edit
0

answered 2017-07-07 10:33:02 +0800

cor3000 gravatar image cor3000
6280 2 7

With ROD enabled an onDataLoading event is triggered (before the elements are rendered). In a listener you can post a custom event (e.g. "onAfterDataLoading") with a lower priority which will then be called after the listitems have been created.

see updated example: http://zkfiddle.org/sample/3kj2d8h/2-Listbox-ROD-trigger-event-of-new-page-rendered

However usually this it not needed since you already know the elements in your model even before they are rendered. Inside your template or item renderer you can setup any event listener you want without having to wait until everything is rendered.

Basically when using a listmodel as the source for listitems it's generally an error to access the listitems directly. The information required should already be in the model or added inside the template. Adding things later will just cause inconsistencies between the model and the component tree.

So if you can share some reasons why you think you need to access the listitems after rendering I am sure there is a better solution.

link publish delete flag offensive edit

Comments

It's exactly what I need, but, I tried with MVVM and the event "onDataLoading" sometimes when render on demand loads data to listitems the event "onDataLoading" isn't triggered. When this event is exactly triggered?

eclipse2 ( 2017-07-11 08:15:15 +0800 )edit

you can check your network panel (e.g in chrome developer tools) to see when it is triggered and when it seems missing.

cor3000 ( 2017-07-11 09:41:48 +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: 2017-07-06 08:03:40 +0800

Seen: 24 times

Last updated: Jul 07 '17

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