ExtJS (Grid): How do I traverse the data of a Grid
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". 开发者_Go百科How do I traverse the data of the grid?
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;
}
}
}
精彩评论