1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    30
    Vote Rating
    0
    Answers
    3
    Isnogud is on a distinguished road

      0  

    Default Answered: Store.load(param) not working?

    Answered: Store.load(param) not working?


    Hi,
    I have a problem with my store and the load() function.
    I tried this:
    Store:
    Code:
        config : {
            model : 'MyApp.model.MyAppModel',
            proxy : {
                type : 'ajax',
                url :'../app/statistics.json',
                extraParams: {
                    type: 'NECESSARY_TYPE'
                },
                reader : {
                    type : 'json',
                    rootProperty : 'statistics'
                }
            }
        }
    Code:
            var myStore= Ext.data.StoreManager.get('MyStore');
            var storeParams = {
                entity: record.get('entityId')
            };
            if (record.get('anotherId')) {
                storeParams.anotherId= record.get('anotherId');
            }
            myStore.load(storeParams);
    But it did not work. The entityId was always 1, so it didn't change and I don't know why.
    Then I tried this:
    Code:
    myStore.getProxy().setExtraParams({entity: record.get('entityId')});
    But it overrides(deletes) the param 'type' in the store/proxy configuration which was also horrible.

    Then I did this:
    Code:
       var myStore= Ext.data.StoreManager.get('MyStore');
            myStore.getProxy().setExtraParams({
                entity: record.get('entityId'),
                anotherId: record.get('anotherId'),
                type : 'NECESSARY_TYPE'
            });
            myStore.load();
    And it's working. But I don't want to have too much information in my controller.
    What am I doing wrong here?

  2. Nevermind, forgot to tell the function that these are params.


    Code:
    var storeParams = {
    entityId: record.get('entityId'),
    anotherId: record.get('anotherId')
    };     
     myStore.load({params : storeParams});

  3. #2
    Sencha User
    Join Date
    Dec 2012
    Posts
    30
    Vote Rating
    0
    Answers
    3
    Isnogud is on a distinguished road

      0  

    Default


    Nevermind, forgot to tell the function that these are params.


    Code:
    var storeParams = {
    entityId: record.get('entityId'),
    anotherId: record.get('anotherId')
    };     
     myStore.load({params : storeParams});

Tags for this Thread