Extjs 如何计算sencha gridview中的行数?

Extjs 如何计算sencha gridview中的行数?,extjs,sencha-touch,Extjs,Sencha Touch,我的页面上有一个Gridview,我正在使用缓冲存储。是否有一种方法可以获取行计数的可见数目。谢谢以下是一个示例代码,您可以尝试:(我希望您能从中获得一些想法) 这将获得渲染的所有记录。由于您使用的是bufferedRenderer,这也将返回渲染但不在视图中的记录,因此您可以检查并放置缓冲区的偏移量 注意:我在使用ExtJs 5时有类似的逻辑,但还没有在touch中进行测试。谢谢,我会试试。Ext.fly(me.view.getCell(record,item))。select('cell s

我的页面上有一个Gridview,我正在使用缓冲存储。是否有一种方法可以获取行计数的可见数目。谢谢

以下是一个示例代码,您可以尝试:(我希望您能从中获得一些想法)

这将获得渲染的所有记录。由于您使用的是bufferedRenderer,这也将返回渲染但不在视图中的记录,因此您可以检查并放置缓冲区的偏移量


注意:我在使用ExtJs 5时有类似的逻辑,但还没有在touch中进行测试。

谢谢,我会试试。Ext.fly(me.view.getCell(record,item))。select('cell selector class')仅在呈现记录时返回正确的值。因此,请确保在渲染网格后调用它。
// 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);