作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在此示例中:
http://dev.sencha.com/deploy/ext-4.0.2a/examples/grid/buffer-grid.html
我想添加一个标题为“全部读取”的按钮,单击该按钮时,应该加载所有行,因此不再需要缓冲。
当用户希望对所有内容有更多控制而不必在特殊情况下等待缓冲区完成时,此功能很有用。
谢谢,任何帮助表示赞赏
最佳答案
使用具有共同模型的两个存储。
第一个是当前的(带有缓冲,分页等)。第二个是普通存储,没有缓冲,分页等。单击“全部读取”时,只需将每条记录加载到第二个存储中,并用新数据更新第一个。
这是一个例子:
Ext.create ('Ext.grid.Panel', {
renderTo: Ext.getBody () ,
width: 300 ,
height: 300 ,
store: bufferingStore ,
columns: [ ... ] ,
tbar: {
items: [{
xtype: 'button' ,
text: 'Read all' ,
handler: function (btn) {
// Here's the call to retrieve all records
// Also you can do it with 'autoLoad: true' param
normalStore.load ();
// Then, flush the bufferingStore, currently use by the grid
bufferingStore.removeAll ();
// Populate bufferingStore with normalStore
normalStore.each (function (record) {
bufferingStore.add (record);
});
}
}]
}
});
关于extjs - EXT JS。如何在“缓冲滚动”示例中加载所有行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7870553/
我是一名优秀的程序员,十分优秀!