Tuesday, November 24, 2009

Infragistics recursive line looping and checking check boxes.


function WaiveAllRows(grid, rows) {
for (var k = 0; k < rows.length; k++) {

var childRow;
var tempRow = rows[k];
if (tempRow == null)
childRow = rows.getRow(k);
else
childRow = igtbl_getRowById(tempRow.id);
if (childRow != null) {
var childCell = childRow.getCellFromKey('Waive');
if (childCell != null) {
var waiveCheckBoxValue = childCell.getValue();
if (waiveCheckBoxValue == "false") {
//Set the event to true, so the any other dependent changes can be made.
//Example: Setting waive check box will grey out the Request NRC
childCell.setValue("true", true);
}
}
if (childRow.ChildRowsCount > 0) {
WaiveAllRows(grid, childRow.getChildRows());
}
}
}
}

function lnkICBLineItemWaiveAll_Click() {
var gridId = '<% =uwgICBLineItems.ClientID %>';
var grid = igtbl_getGridById(gridId);
var rows = grid.Rows;
if (grid.Rows.length > 0) {
WaiveAllRows(grid, grid.Rows);
}
return false;
}