当我点击分页工具栏上的下一个按钮时,商店开始加载,第二页的数据出现并立即消失。 当我查看网络时,我看到了两个请求:首先纠正第二页,第二个不正确,它覆盖第二页的数据。
网络标签的屏幕截图
我的模特:
Ext.define('Admin.view.items.ItemsModel', {
id: 'ItemsModel',
extend: 'Ext.app.ViewModel',
alias: 'viewmodel.items',
requires: [
'Admin.proxy.API'
],
stores: {
storeItemsAll: {
type: 'store',
autoLoad: true,
autoDestory: true,
disableCaching: false,
proxy: {
type: 'api',
url: SITE_URL + '/api/items',
reader: {
type: 'json',
rootProperty: 'data',
totalProperty: 'total'
}
},
fields: [{
type: 'string',
name: 'id'
}, {
type: 'string',
name: 'name'
}, {
type: 'string',
name: 'updated_at'
}, {
type: 'string',
name: 'created_at'
}]
}
}
});
我的分页工具栏:
bbar: {
id: 'ItemsPaginator',
xtype: 'pagingtoolbar',
displayInfo: true,
bind: {
store: '{storeItemsAll}'
}
}
我的网格代码:
Ext.define('Admin.view.items.ItemsTable', {
extend: 'Ext.panel.Panel',
xtype: 'items-table',
requires: [
'Ext.grid.Panel',
'Ext.grid.View'
],
title: __('items_details_h1'),
height: 'fit',
bodyPadding: 15,
layout: {
type: 'vbox',
align: 'stretch'
},
items: [{
xtype: 'container',
layout: 'fit',
items: [{
id: 'ItemsTable',
xtype: 'gridpanel',
userCls: 'ypoints-list',
header: false,
title: __('wizard_items_added'),
hideHeaders: false,
scrollable: {
x: false,
y: true
},
bind: {
store: '{storeItemsAll}'
},
viewConfig: {
getRowClass: function(record, rowIndex, rowParams, store) {
return 'ypoint-row';
},
emptyText: __('no_data'),
deferEmptyText: false
},
rootVisible: false,
dockedItems: [{
dock: 'top',
items: [{
xtype: 'container',
userCls: 'ypoints-btns',
items: [{
xtype: 'button',
height: 35,
text: __('items_add'),
userCls: 'ypoints-btn',
handler: 'onItemAdd'
}]
}]
}],
bbar: {
id: 'ItemPaginator',
xtype: 'pagingtoolbar',
displayInfo: true,
bind: {
store: '{storeItemsAll}'
}
},
columns: [{
text: __('item_name_field'),
dataIndex: 'name',
sortable: true,
flex: 1
}, {
text: __('item_updated_at_field'),
dataIndex: 'updated_at',
sortable: true,
flex: 1
}, {
text: __('item_created_at_field'),
dataIndex: 'created_at',
sortable: true,
flex: 1
}, {
xtype: 'actioncolumn',
header: __('actions_field'),
flex: 1,
items: [{
iconCls: 'x-fa fa-pencil-square-o',
tooltip: __('edit_item'),
handler: 'onItemEdit'
}, {
iconCls: 'x-fa fa-trash',
tooltip: __('remove_item'),
handler: 'onItemRemove'
}, {
iconCls: 'x-fa fa-eye',
tooltip: __('preview_item'),
handler: 'onItemPreview'
}]
}]
}]
}]
});