ExtJS 4.1.0网格性能问题 [英] ExtJS 4.1.0 grid performance issue
问题描述
我正在使用一个包含50列和超过1000条记录的ExtJS网格。在垂直/水平滚动和单元格编辑时,我正面临性能问题。
I am using an ExtJS grid with 50 columns and more than 1000 records. I am facing performance issues while scrolling vertically/horizontally and for cell editing. Is it possible to get smooth performance without pagination for this size of data, or is pagination the only solution?
推荐答案
你应该使用这个数据吗?无限的scolling。这可以让您在1000个记录中显示您的表,而不是在dom中创建,因此它们并不会降低浏览器的速度。
You should use infinite scolling. This allows you to display your table with 1000 records, while they are not created in the dom, so they are not slowing down your browser.
查看文档中的此示例。
您需要定义一个缓冲存储并配置无限滚动的参数,如下所示:
You need to define a buffered store and configure the parameters for infinite scrolling, like this:
Ext.define('Test.store.Owners', {
extend: 'Ext.data.Store',
model: 'Test.model.PersonalInfo',
autoLoad: true,
buffered: true,
pageSize: 25,
purgePageCount: 5,
leadingBufferZone: 5,
trailingBufferZone: 5,
});
您的后端必须支持分页并返回包含总计的json对象
和
offset
属性。示例:
Your backend must support pagination and return a json object including the total
and offset
properties. Example:
{"total":"1003",
"offset":225,
"data":[
{"id":"227","name":"Candice","address":"P.O. Box 247, 7586 Eget Av.","state":"Minnesota"},
{"id":"228","name":"Benedict","address":"P.O. Box 664, 7028 Vitae Rd.","state":"FL"},
...
}
我的答案是ExtJs 4.2.2,我不知道与4.1版有区别。
My answer is for ExtJs 4.2.2, I don't know if there is a difference with the version 4.1.
这篇关于ExtJS 4.1.0网格性能问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!