在ExtJs 5中,我从控制器尝试从视图调用网格商店中的store.load(),具有以下配置。我到达了store.load()回调,但记录为空,Chrome开发人员工具未显示任何HTTP请求。
商店
Ext.define('vfw.view.carrierpull.CarrierPullStore',{
extend: 'Ext.data.Store',
storeId: 'carrierPullStore',
model: 'vfw.view.carrierpull.CarrierPullModel',
pageSize: 25,
remoteFilter: true,
remoteSort: true,
remoteGroup: true,
simpleFilter: false,
simpleSort: false,
autoFilter: false,
proxy: {
type: 'ajax',
url: 'getCarrierPull',
filterParam: 'filters',
limitParam: 'pageSize',
paramsAsJson: true,
actionMethods: {
create: 'POST',
read: 'POST',
update: 'POST',
destroy: 'POST'
},
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
reader: {
type: 'json',
rootProperty: 'data',
totalProperty: 'totalrows'
},
writer: {
type: 'json',
allowSingle: true
}
}
});
网格
{
title: 'List',
layout: 'fit',
items: [ {// Ext.create('Ext.grid.Panel',{
xtype: 'grid',
title: 'SKU',
reference: 'mainGrid',
selType: 'checkboxmodel',
selModel: {
checkOnly: true,
injectCheckbox: 0
},
viewConfig: {
enableTextSelection: true
},
store: Ext.data.StoreManager.lookup('carrierPullStore'),
bufferedRenderer: false,
columns: [
{ text: 'Ship Via', dataIndex: 'shipvia' },
{ text: 'Ship Via Description', dataIndex: 'shipvia' },
{ text: 'Pull Trailer Code', dataIndex: 'pullTrlrCode' },
{ text: 'Ship Via', dataIndex: 'shipvia' },
{ text: 'Pull Time', dataIndex: 'pullTime' },
{ text: 'Ship Via', dataIndex: 'shipvia' },
{ text: 'Ship to Zip', dataIndex: 'shiptoZip' }
],
// paging bar on the bottom
bbar: { // Ext.create('Ext.toolbar.Paging', { // PagingToolbar', {
xtype: 'pagingtoolbar',
store: Ext.data.StoreManager.lookup('carrierPullStore'),
pageSize: 25,
displayInfo: true,
displayMsg: 'Displaying items {0} - {1} of {2}',
emptyMsg: "No items to display",
items:[
'-', {
text: 'Show Preview',
//pressed: pluginExpanded,
enableToggle: true,
toggleHandler: function(btn, pressed) {
var preview = Ext.getCmp('gv').getPlugin('preview');
preview.toggleExpanded(pressed);
}
}]
}
}
]}
这是应该触发http请求的控制器代码:
onList: function () {
var st = this.lookupReference('mainGrid').getStore();
console.debug('loading store: ' , st); // I see the store object
st.reload({callback: function(records,options,success) {
console.debug(records,options); // I reach here. Records is empty, options is populated
}});
},
*
的 修改 *
模型
Ext.define('vfw.view.carrierpull.CarrierPullModel', {
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.carrierpull',
data: {
name: 'Hello World'
}
//TODO - add data, formulas and/or methods to support your view
});