ExtJS(网格):如何遍历网格数据

时间:2010-06-04 16:01:48

标签: extjs grid traversal

我需要验证来自网格的信息:
- 检查将“required”列设置为“Yes”的所有行是否将“Status”列设置为“Received”。

如何遍历网格数据?

1 个答案:

答案 0 :(得分:0)

我找到了答案:

var records = gridRequisitos.store.data.items,
obligatorio,
estadoReq;

requisitosCumplidos = true;

// are there any records?
if (records.length > 0) {

    // traverse records
    for (var i = 0; i < records.length; i++) {

        // get specific columns
        estadoReq = records[i].get('estadoRequisitoDescripcion');
        obligatorio = records[i].get('obligatorio');

        // if it's required and status == pending...
        if (obligatorio == 'S' && estadoReq == 'Pendiente') {
            requisitosCumplidos = false;
            break;
        }
    }
}