Results 1 to 6 of 6

Thread: store.on('load... fire count is window reopen count

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    34
    Answers
    4
    Vote Rating
    1
      0  

    Default store.on('load... fire count is window reopen count

    Hello,

    i have a window with, Grid
    PHP Code:
    storestore_DataCall,
    data: [store_DataCall.load()],
    columns: [{ 
    in window is:
    PHP Code:
    beforeshow: function() {
     
    store_DataCall.on('load', function(storerecords) {
      
    console.log("test");
     });

    1. first open fire: test
    2. second open fire: test, test
    3. third open fire: test, test, test

    what is wrong?

    Thank you!

  2. #2
    Sencha User
    Join Date
    Nov 2012
    Posts
    432
    Answers
    11
    Vote Rating
    10
      0  

    Default

    Could you send a screen cap of the console.log so I can see how you are getting there and what you are seeing?

  3. #3
    Sencha User
    Join Date
    Jun 2012
    Location
    India
    Posts
    50
    Answers
    4
    Vote Rating
    3
      0  

    Default

    Are you recreating the window object every time you open?
    If yes, Then you need to unregister the load event before close/destroy of window. Use an un method to un register the load event.

  4. #4
    Sencha User
    Join Date
    Nov 2011
    Posts
    34
    Answers
    4
    Vote Rating
    1
      0  

    Default

    Hello,

    @girish.arjunagi what is the best way, to unregister the load event.
    I have not found a solution!

    Thank you for your reply!

  5. #5
    Sencha User
    Join Date
    Jun 2012
    Location
    India
    Posts
    50
    Answers
    4
    Vote Rating
    3
      0  

    Default

    Instead of using the inline event handler use the named function, which will be used as reference while un registering the events. Try with the below code. Hope this might help you.

    Code:
    beforeshow: function() {
     store_DataCall.on('load', this.onStoreLoad, this);
    },
    onStoreLoad : function(store, records) {
      console.log("test");
    }
    //on destroy or close of window
    onDestroy : function(){
    this.callParent(arguments);
    store_DataCall.un('load', this.onStoreLoad, this);
    }

  6. #6
    Sencha User
    Join Date
    Nov 2011
    Posts
    34
    Answers
    4
    Vote Rating
    1
      0  

    Default

    beforeshow: function() {
    dataStore.on('load', this.onStoreLoad, this);
    },
    onStoreLoad : function(store, records) {
    console.log("test");
    }

    show in console:

    TypeError: listener.fireFn is undefined


    and no changes when using:
    beforedestroy: function() {

    dataStore.un('load', this.onStoreLoad, this);



Posting Permissions

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