how to post array by store of sencha
arrays, extjs, load, store
Solution
I found the solution , thank you
1, just use jsonData instead params during Ajax, like follows:
Ext.Ajax.request({
url: ajmd.util.version.getHost()+'/archimedes/update/selfInfo',
method:'post',
// params:params,
jsonData:params
});
2, or just encode the data before send
params.t1 = Ext.encode(params.t1);
Problem
I create one store and init it with some params with one array.when I execute the load function, the array parameter becomes a string '[object object]' the code as follows: store: ``` Ext.define('test.store.info',{ extend: 'Ext.data.Store', config:{ model:'test.model.info', proxy:{ type:'ajax', url:'http://domain/path', actionMethods:'POST' } } }); ``` model: ``` Ext.define('test.model.info',{ extend:'Ext.data.Model', config:{ fields:[ 'code', 'data' ] } }) ``` use in controller: ``` var store = Ext.getStore('info'); params = { t1:[{ f1:'aa' },{ f2:'bb' }], t2:'ddd' } console.log(params) store.load({ params:params }); ``` or I just use Ajax function instead load function , the result is the same. ``` Ext.Ajax.request({ url:'http://domain/path', method:'post', params:params, }); ``` I check the xhr within network of browser , it is a string as follows: ``` t1:[object Object] t1:[object Object] t2:ddd ``` when I check the server log, it shows : ``` t1:'[object Object]' t1:'[object Object]' t2:'ddd' ```