Results 1 to 5 of 5

Thread: Dataview Event afterrender

  1. #1
    Ext JS Premium Member
    Join Date
    Sep 2009
    Posts
    26

    Default Dataview Event afterrender

    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?

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    The DataView should be filled in the afterrender event if the store is already loaded (and remember that loading is asynchronous!).

  3. #3
    Ext JS Premium Member
    Join Date
    Sep 2009
    Posts
    26

    Default

    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.

  4. #4
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    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:
    Code:
    store.load({
      callback: function(){
        // now both the store and the dataview are loaded
      }
    });

  5. #5
    Ext JS Premium Member
    Join Date
    Sep 2009
    Posts
    26

    Default

    Ahhh! That did the trick.

    Thank you so much!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •