vijaykudayakumar
17 Jul 2008, 10:00 AM
Hi All,
This function validates the editor grid panel and shows any error if needed. some times this is very useful.
The function returns false if there is an error else it returns true.
function validateEditorGridPanel(gridId){
var grid = Ext.getCmp(gridId);
var rows = grid.store.data.length;
var cols = grid.colModel.config.length;
for (var row = 0; row < rows; row++){
var record = grid.store.getAt(row);
for (var col = 0; col < cols; col++){
var cellEditor = grid.colModel.getCellEditor(col, row);
if (cellEditor != undefined) {
var columnName = grid.colModel.getDataIndex(col);
var columnValue = record.data[columnName];
cellEditor.field.setValue(columnValue);
if (!cellEditor.field.isValid()) {
grid.startEditing(row, col);
return false;
}
}
}
}
return true;
},
Regards,
Vijay K Udayakumar
This function validates the editor grid panel and shows any error if needed. some times this is very useful.
The function returns false if there is an error else it returns true.
function validateEditorGridPanel(gridId){
var grid = Ext.getCmp(gridId);
var rows = grid.store.data.length;
var cols = grid.colModel.config.length;
for (var row = 0; row < rows; row++){
var record = grid.store.getAt(row);
for (var col = 0; col < cols; col++){
var cellEditor = grid.colModel.getCellEditor(col, row);
if (cellEditor != undefined) {
var columnName = grid.colModel.getDataIndex(col);
var columnValue = record.data[columnName];
cellEditor.field.setValue(columnValue);
if (!cellEditor.field.isValid()) {
grid.startEditing(row, col);
return false;
}
}
}
}
return true;
},
Regards,
Vijay K Udayakumar