开发者

I'm having trouble with ExtJS4 passing a querystring (parameter) with store.load

I'm having trouble passing parameters into the GetAll method of my controller. I tried Filter as below but no luck. any suggestions?

Ext.define('AM.store.Sessions', {
    extend: 开发者_如何转开发'Ext.data.Store',
    model: 'AM.model.Session',
    autoLoad: false,

    proxy: {
        type: 'ajax',
        api: {
            read: 'Session/GetAll',
            update: 'data/updateUsers.json'
        },
        reader: {
            type: 'json',
            root: 'Data',
            successProperty: 'success'
        },
        filters: [
            new Ext.util.Filter({
                    property: 'eyeColor',
                    value: 'brown'
                })
        ]
    }
});


Im not sure what you are after. But stating extraParams in you proxy will put that parameter on every load() on your store. Like this.

Ext.define('AM.store.Sessions', {
    extend: 'Ext.data.Store',
    model: 'AM.model.Session',
    autoLoad: false,

    proxy: {
        type: 'ajax',
        api: {
            read: 'Session/GetAll',
            update: 'data/updateUsers.json'
        },
        extraParams:{
            eyeColor:'brown'
        } 
        reader: {
            type: 'json',
            root: 'Data',
            successProperty: 'success'
        }
    }
});

You could also listen on the "beforeLoad" event on the store and modifu parameters there.

OR.. you could just pass parameters to the load() function as this

var myStore = Ext.create('AM.store.Session');

myStore.load({
     params:{
         eyeColor:'brown'
     }
})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜