本文介绍了Extjs页面工具栏与网格面板无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在extjs中有以下代码分页...即使我将它设置为每页5条记录,仍然显示6 ...而第1页的2不显示1...我有问题来自sql的数据 .. ..所以我决定尝试与记忆库...但我仍然没有得到传呼正确....任何帮助?
I have the below code for paging in extjs... Even though I set it as 5 records per page, it still shows 6... and page 1 of 2 does not show "1"... I had problem with data from sql Click here to go that Thread.... so I decided to try out with memory store... but I still don't get the paging right.... any help?
constructor: function () {
this.callParent(arguments);
var store = Ext.create('Ext.data.Store', {
pageSize: 5,
storeId: 'simpsonsStore',
fields: ['name', 'email', 'phone'],
data: {
'totalCount': "6",
'items': [{
'name': 'Lisa',
"email": "[email protected]",
"phone": "555-111-1224"
}, {
'name': 'Bart',
"email": "[email protected]",
"phone": "555-222-1234"
}, {
'name': 'Homer',
"email": "[email protected]",
"phone": "555-222-1244"
}, {
'name': 'Marge',
"email": "[email protected]",
"phone": "555-222-1254"
}, {
'name': '29',
"email": "[email protected]",
"phone": "555-222-1254"
}, {
'name': '30',
"email": "[email protected]",
"phone": "555-222-1254"
}]
},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items',
totalProperty: 'totalCount'
}
}
});
this.grid = Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
disableSelection: true,
loadMask: true,
stripeRows: true,
trackover: true,
renderTo: Ext.getBody(),
store: store,
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Email',
dataIndex: 'email'
}, {
text: 'Phone',
dataIndex: 'phone'
}],
bbar: Ext.create('Ext.PagingToolbar', {
store: store,
displayInfo: true,
displayMsg: 'Displaying Surveys {0} - {1} of {2}',
emptyMsg: "No Surveys to display"
})
});
grid.loadPage(1);
}
}
});
}});
推荐答案
内存代理不能使用常规的寻呼机制。您需要一个特殊的用户扩展类:向下滚动到使用本地数据分页部分。
Memory proxy wont work with a regular paging mechanics. You need a special user extension classes: http://docs.sencha.com/ext-js/4-1/#!/api/Ext.toolbar.Paging Scroll down to "Paging with Local Data" section.
这篇关于Extjs页面工具栏与网格面板无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!