View Full Version : How to know when the list is done rendering (if you add stuff to the data store)

28 Jul 2010, 6:21 PM
So I send an ajax request... get the data.
Then I go through the lists data store and and add the items via the .add method of the store.
The list renders fine with the new data. However I would like to manipualte some of the dom elements of the list.
How do I know when the template is done rendering the list?


29 Jul 2010, 4:44 PM
You can add an afterrender listener to the list

29 Jul 2010, 7:05 PM
This only fires once though -- it doesn't fire everytime you add to the list's data store. It will fire when the initial data is added but not again when we add additional data or change the store.

29 Jul 2010, 9:23 PM
Try different listeners, either one of them fires after the list re-renders, or you add a bug because none of them do :) Maybe a listener with layout in it's name (I'm on my iPhone so I can't view the doc at the moment... my next bored project, sencha touch jdoc :) )

29 Jul 2010, 9:44 PM
Or try adding a datachanged or update listener to the store and see if that fires after the re-render

30 Jul 2010, 5:13 PM
I think listening to the data changed would be a hack since the ordering in which you receive the event determines if this method will work. If you receive the data store update event before the list does then you will try to insert into a dom element that does not exist. It will only work if you get the event after the list has received the event and rendered the proper element.

I think they should extend the template to fire a finishrender event or something along those lines so everytime the template re renders you can do some manipulation ... either that or fire afterrender when the template is re rendered