当我在 extjs 中使用分页工具栏时网格加载所有数据
Grid loading all data while i am using paging toolbar in extjs
我正在从json格式的servlet加载数据。我正在使用分页工具栏进行导航。但是网格一次加载所有数据。我该怎么做 将部分数据加载到网格中以在网格上执行分页控制。请帮助我。 Ext.require([ '分机数据。', "外格。" ]);
Ext.onReady(function(){
Ext.define('Book',{
extend: 'Ext.data.Model',
fields: [
// set up the fields mapping into the xml doc
// The first needs mapping, the others are very basic
'sno',
'name', 'salary'
]
});
Ext.Loader.setConfig({
enabled : true
});
// create the Data Store
var store = Ext.create('Ext.data.Store', {
model: 'Book',
pageSize:25,
proxy: {
// load using HTTP
type: 'ajax',
//url: 'http://localhost:8080/sampleweb/AccessServlet',
url: 'http://localhost:8080/sampleweb/DataServlet',
// the return will be XML, so lets set up a reader
reader: {
type: 'json',
root:'jsonObj',
totalProperty: 'totalcount'
}
}
});
store.load({
params:{
start:0,
limit: 25
}
});
var rowEditing = Ext.create('Ext.grid.plugin.RowEditing');
var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
// create the grid
var grid = Ext.create('Ext.grid.Panel', {
store: store,
columns: [
{text: "sno",width:140, dataIndex: 'sno', sortable: true
,editor: {
xtype: 'numberfield',
allowBlank: false,
minValue: 1,
maxValue: 150000
}},
{text: "name", width: 180, dataIndex: 'name', sortable: true,
editor: {
xtype: 'combobox',
typeAhead: true,
triggerAction: 'all',
selectOnTab: true,
store: [
['Shade','Shade'],
['Mostly Shady','Mostly Shady'],
['Sun or Shade','Sun or Shade'],
['Mostly Sunny','Mostly Sunny'],
['Sunny','Sunny']
]}},
{text: "salary", width: 180, dataIndex: 'salary', sortable: true,
editor: {
xtype: 'numberfield',
allowBlank: false,
minValue: 1,
maxValue: 1000000
}},
{
xtype: 'actioncolumn',
width: 30,
sortable: true,
menuDisabled: true,
items: [{
icon: 'http://etf-prod-projects-1415177589.us-east- 1.elb.amazonaws.com/trac/docasu/export/2/trunk/client/extjs/shared/icons/fam/delete.gif',
handler: function(grid, rowIndex, colIndex) {
store.removeAt(rowIndex);
}
}]
}
],
dockedItems: [
{
xtype: 'pagingtoolbar',
displayInfo: true,
pageSize:25,
dock: 'bottom',
store: store
}
],
viewConfig: {
forceFit: true
},
/*dockedItems: [{
xtype: 'toolbar',
items: [{
text: 'Add',
iconCls: 'icon-add',
handler: function(){
// empty record
store.insert(0, new Book());
rowEditing.startEdit(0, 0);
}
}, ]
}],*/
renderTo:'example-grid',
width: 560,
plugins: [rowEditing],
height: 400
});
});
您已经为网格分页总记录和基于限制和开始的行渲染了两件事,然后网格显示总计和页面偏移记录。默认情况下,将 0 分散为 25,因为您设置 limit=25 并开始 =0。
相关文章:
- 使用requireJS的jqGrid-网格加载但不起作用
- ExtJS网格未从Ext.data.XmlStore加载数据
- 网格分页栏在重新加载时未更新
- 清除网格中的存储和加载搜索结果
- 存储区不在网格面板内部加载-ExtJS
- 回调以设置postdata,而无需重新加载网格
- 第一页加载时,有角度的ng网格固定标题不是静态的
- 页面加载后,将FooTable断点应用于网格视图中的列标题
- 将数据从服务器端加载到 ExtJs 网格中
- ExtJS——更改代理URL然后加载存储不会更新网格
- ASP网格视图的重新加载事件
- 我怎么能用Codeigniter在可滚动的部分创建一个无限向下滚动的网格加载程序呢
- 在网格加载数据后,将行列文本设置为粗体
- 剑道网格加载微调器不在屏幕中央
- 当我在 extjs 中使用分页工具栏时网格加载所有数据
- Jqgrid为空,不从主网格加载json数据
- Kendo网格加载后如何绑定JSON数据
- 剑道UI网格加载数据错误
- 我如何在ExtJS 6中响应成功的网格加载并检查响应
- "JqGrid不是一个函数“;在网格加载并工作之后