我在 extjs 3.1 中创建分页,但由于某种原因它不起作用。请我做错了什么。我使页数= 5。分页计数正确。意味着它显示底部的页数即将到来。
但网格显示所有数据。我的代码如下
Ext.onReady(function() {
var store = new Ext.data.JsonStore({
root : 'data',
totalProperty : 'total',
idProperty : 'facId',
fields : [ "address1", "address2", "city", "country", "ehsContact",
"facilityManager", "facilityProduct", "facilityType", "fax",
"facId", "name", "phone", "state", "subGroupA", "subGroupB",
"zipCode", {
name : 'businessUnitId',
mapping : 'businessVO.businessId'
}, {
name : 'businessUnitName',
mapping : 'businessVO.businessName'
} ],
proxy : new Ext.data.HttpProxy({
url : 'facility.do?method=getAllFacility'
})
});
var grid = new Ext.grid.GridPanel({
width : 700,
height : 500,
title : 'ExtJS.com - Browse Forums',
store : store,
trackMouseOver : false,
disableSelection : true,
loadMask : true,
columns : [ {
id : 'facId',
header : "facId",
dataIndex : 'facId',
sortable : true
}, {
header : "fax",
dataIndex : 'fax',
width : 100,
sortable : true
}, {
header : "state",
dataIndex : 'state',
sortable : true
}, {
id : 'address1',
header : "address1",
dataIndex : 'address1',
sortable : true
} ],
viewConfig : {
forceFit : true,
},
bbar : new Ext.PagingToolbar({
pageSize : 5,
store : store,
displayInfo : true,
displayMsg : 'Displaying topics {0} - {1} of {2}',
emptyMsg : "No topics to display"
})
});
store.load({
params : {
start : 0,
limit : 5
}
});
centerPanel = Ext.getCmp('centerlPanel');
centerPanel.add({
layout : 'border',
region : 'center',
layout : 'fit',
items : grid
});
centerPanel.doLayout();
});