I have a Gridview on my page and I'm using buffered store. Is there a way to get the visible number of row count. Thank you
我的页面上有一个Gridview,我正在使用缓冲存储。有没有办法获得可见的行数。谢谢
1 个解决方案
#1
Here is a sample code that you can try: (I hope you'll get some idea from this)
以下是您可以尝试的示例代码:(我希望您能从中获得一些想法)
// The below condition has to be checked for each record
// record: record instance
var me = this; // grid scope
Ext.Array.each(me.columns, function (item) { // iterate through each column in the grid
if (item.hidden || !item.dataIndex) { // you can avoid hidden columns and one's that re not bound to the store
return;
}
var cellVal;
try {
cellVal = Ext.fly( me.view.getCell(record, item)).select('cell selector class').elements[0].innerHTML;
} catch (e) {
// handle if you want
}
if (!Ext.isEmpty(cellVal)) {
// this record has been rendered
}
}, this);
This will get you all the records that are rendered. Since you are using a bufferedRenderer, this will also return the records that are rendered but not in the view, you can check and put an offset for the buffer.
这将获取所有呈现的记录。由于您使用的是bufferedRenderer,这也会返回渲染但不在视图中的记录,您可以检查并为缓冲区添加偏移量。
Note: I've a similar logic in working in ExtJs 5 but haven't tested in touch.
注意:我在使用ExtJs 5时有类似的逻辑,但没有进行过触摸测试。
#1
Here is a sample code that you can try: (I hope you'll get some idea from this)
以下是您可以尝试的示例代码:(我希望您能从中获得一些想法)
// The below condition has to be checked for each record
// record: record instance
var me = this; // grid scope
Ext.Array.each(me.columns, function (item) { // iterate through each column in the grid
if (item.hidden || !item.dataIndex) { // you can avoid hidden columns and one's that re not bound to the store
return;
}
var cellVal;
try {
cellVal = Ext.fly( me.view.getCell(record, item)).select('cell selector class').elements[0].innerHTML;
} catch (e) {
// handle if you want
}
if (!Ext.isEmpty(cellVal)) {
// this record has been rendered
}
}, this);
This will get you all the records that are rendered. Since you are using a bufferedRenderer, this will also return the records that are rendered but not in the view, you can check and put an offset for the buffer.
这将获取所有呈现的记录。由于您使用的是bufferedRenderer,这也会返回渲染但不在视图中的记录,您可以检查并为缓冲区添加偏移量。
Note: I've a similar logic in working in ExtJs 5 but haven't tested in touch.
注意:我在使用ExtJs 5时有类似的逻辑,但没有进行过触摸测试。