PDA

View Full Version : Dataview Event afterrender



rssk
4 Sep 2009, 6:26 AM
Hi all,

I have a problem with the dataviews afterrender listener. The dataview is loaded by a jsonstore. A easy xtemplate is set, too.
But the rendered content of the template is still not available in the afterrender-listener defined function. Are I'm using the wrong listener?

Any suggestions?

Condor
4 Sep 2009, 6:32 AM
The DataView should be filled in the afterrender event if the store is already loaded (and remember that loading is asynchronous!).

rssk
4 Sep 2009, 6:43 AM
Thanks for reply.
Does this mean the afterrender event isn't related to the stores load()? I'm calling the store.load() directly after configurate it, because there is no autoLoad configuration parameter for DataView if I remind correctly.

Condor
4 Sep 2009, 6:48 AM
autoLoad or load(), it doesn't matter. Loading is asynchronous.

Calling load() (or setting autoLoad:true) only sends a request to the server. You have to wait for the server to respond until you can do something with the data.

Normally I would advise using the load event handler, but the dataview is filled by the datachanged event that is fired after the load event.

The only thing that is executed after the datachanged event is the store load callback:

store.load({
callback: function(){
// now both the store and the dataview are loaded
}
});

rssk
4 Sep 2009, 6:54 AM
Ahhh! That did the trick.

Thank you so much!!