Results 1 to 5 of 5

Thread: Loading a store from a controller causing the last dataitem action to fire again

  1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    76
    Answers
    1
    Vote Rating
    1
      0  

    Default Answered: Loading a store from a controller causing the last dataitem action to fire again

    Hey this is really weird.

    I have a dataview that shows a list of dataitems.
    Each data item has a checkbox.

    Since I didn't know how to catch the 'check' event from inside the dataitem itself, I've caught this event from a controller.

    Whenever I load the store I'm using the controller to change it's proxy and load it manually because I re-use it all over my app.

    The problem is, that the last action I do with the 'check' event keep firing again and again every time I load the store.

    This is really weird, and it drive me crazy.

    Thanks for the help!

  2. I came up with the following workaround, adding a listener to the store:



    listeners: {
    beforeload: function( store, operation, eOpts ) { //A workaround to make the follow actions not to fire again.
    console.log('Before load');
    return true;
    }

    },

    Don't know why this works, but it does.

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3932
    Vote Rating
    1272
      0  

    Default

    Are you loading the store somewhere else you are using the store?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    76
    Answers
    1
    Vote Rating
    1
      0  

    Default

    I'm changing the proxy and loading the manually:

    Ext.getStore('StoreId').getProxy().setUrl(ServerAddress+'RestService.svc/ShowLeagues/'+UserId');

    Ext.getStore('StoreId')..load(function(records, operation, success) {
    console.log('loaded records');
    }, this);

    2 views are using the same store, and 1 view is actually a generic view, that loads the store in according to it's context.

  5. #4
    Sencha User
    Join Date
    Mar 2012
    Posts
    76
    Answers
    1
    Vote Rating
    1
      0  

    Default

    I came up with the following workaround, adding a listener to the store:



    listeners: {
    beforeload: function( store, operation, eOpts ) { //A workaround to make the follow actions not to fire again.
    console.log('Before load');
    return true;
    }

    },

    Don't know why this works, but it does.

  6. #5
    Sencha User
    Join Date
    Mar 2012
    Posts
    76
    Answers
    1
    Vote Rating
    1
      0  

    Default Doesn't work.

    Actually, my workaround doesn't work anymore for some reason.

    Probably was unstable.

    I need help

Tags for this Thread

Posting Permissions

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