"Uncaught TypeError: Cannot read property 'indexOf' of undefined"
我的商店在这里:
var objStore = Ext.create('Ext.data.Store',{
//model: 'objModel',
storeId: 'allObjects',
autoLoad: false,
pageSize: 30,
sorters: [{
property: 'nm',
direction: 'asc'
}],
fields:[
{name: 'nm', type: 'string'},
{name: 'id', type: 'string'}
],
proxy: {
type: 'ajax'
},
loadRawData: function(data,append){
var me = this,
result = me.proxy.reader.read(data),
records = result.records;
if (result.success) {
me.totalCount = objArr.totalItemsCount;
me.currentPage = 1;
me.loadRecords(records,{addRecords: append});
me.fireEvent('load',me,records,true);
}
}
});
我的网格:
var pagingTb = Ext.create('Ext.PagingToolbar', {
store: objStore,
displayInfo: true,
displayMsg: 'Показано {0} - {1} из {2}', // формат инфо
loadPage: function(page) {
var me = this;
me.currentPage = page;
me.read({
page: page,
start: (page - 1) * me.pageSize,
limit: me.pageSize,
addRecords: !me.clearOnPageLoad
});
}
});
var objGrid = Ext.create('Ext.grid.Panel', {
id: 'grid',
store: objStore,
height: 500,
columns: [
{header:'№',xtype: 'rownumberer',width:40,style:'text-align:center;'},
{text: 'ID', dataIndex: 'id', width: 50,style:'text-align:center;'},
{text:'Объект', dataIndex: 'nm', width: 300,style:'text-align:center;'}
],
bbar: pagingTb
});
我在按钮的听众中的请求:
listeners:{
click:{
fn: function() {
request=Ext.Ajax.request({
method: 'POST',
url: 'myurl',
success: function(response, opts){
objArr = Ext.decode(response.responseText);
var store = Ext.data.StoreManager.lookup('allObjects');
store.loadRawData(objArr.items, true);
},
failure: function(response, opts) {
console.log('server-side failure with status code ' + response.status);
}
});
}
}
}