如何将参数从视图传递到extjs中的存储?
这是我的商店:
Ext.define('mycomponents.store.mystore', {
extend: 'Ext.data.Store',
alias: 'store.levels',
model: 'mycomponents.model.mymodel',
storeId: 'levels',
restful: true,
autoLoad: true,
proxy: {
type: 'ajax',
headers: {
'Accept': '*/*',
'Cache-Control': 'no-cache',
'Content-Type': 'application/json',
'Authorization': localStorage.token
},
extraParams: {
sort: 'levelid',
'filter[active]': true,
'filter[idparent]': 0
},
reader: {
type: 'json',
root: 'data',
successProperty: 'success'
},
writer: {
type: 'json',
writeAllFields: true,
encode: true,
root: 'data'
},
listeners: {
exception: function (proxy, response, operation) {
var error = Ext.decode(response.responseText);
Ext.MessageBox.show(
{
title: 'REMOTE EXCEPTION',
msg: error.message,
icon: Ext.MessageBox.ERROR,
buttons: Ext.Msg.OK
}
);
}
},
actionMethods: {
read: 'GET'
},
api: {
read: 'http://url...',
create: 'http://url...',
update: 'http://url...',
destroy: 'http://url...'
},
autoSave: true
},
constructor: function (config) {
this.callParent([config]);
}
});
我的观点:
var store = Ext.create('mycomponents.store.mystore', {});
Ext.define('mycomponents.view.myview', {
extend: 'Ext.container.Container',
id: 'leves',
alias: 'widget.levels',
xtype: 'levels',
items: [
{
xtype: 'combobox',
...
}
]
...
}
我需要从视图发送
'filter[idparent]': 1
,
'filter[idparent]': 2
或组合框上的任何更改。我怎样才能做到这一点?