1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    76
    Answers
    1
    Vote Rating
    1
    Monti123 is on a distinguished road

      0  

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

    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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,633
    Answers
    3453
    Vote Rating
    817
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Are you loading the store somewhere else you are using the store?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    76
    Answers
    1
    Vote Rating
    1
    Monti123 is on a distinguished road

      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
    Monti123 is on a distinguished road

      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
    Monti123 is on a distinguished road

      0  

    Default Doesn't work.

    Doesn't work.


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

    Probably was unstable.

    I need help

Thread Participants: 1

Tags for this Thread