views:

168

answers:

1

I need to validate information from a grid:
- check if all the rows that have the "required" column set to "Yes", have the "Status" column set to "Received".

How do I traverse the data of the grid?

A: 

I found the answer:

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;
        }
    }
}
Luis Lobo Borobia