Using Checker column. How to check only enabled records by clicking checkbox in a Header

1 reply. Last post: April 8, 2011 12:12 AM by Yudi
Tags :
  • (None)

Hello InterSoft,

Our grid (ver 7) contain checker column. By default if I check checkbox in a header then all records are checked. What I need to acomplish is: When user click checkbox 'All' in a header then only checkboxes in enabled records should be checked/unchecked. Now in InitRow event I am setting cell to 'ForceNoEdit' and it didn't help (see below). What JS event should I capture to be able to to check only enabled records. Please provide a sample code

Thank you

 

WebGridCell cell = e.Row.Cells.GetNamedItem("CHECKER");

if (cell.Value != null && cell.Value.ToString().ToUpper() != "PENDING NEW" )       cell.ForceNoEdit = true;    
1 attachment

All Replies

Yudi Member

When user clicks the “select/deselect all” checkbox in the column header, the OnCheckBoxClick client-side event is invoked. We can utilize this behavior in order to check/uncheck rows that are enabled.

function WebGrid1_OnCheckBoxClick(controlId, tblName, colName, checkboxValue, originalCheckBoxValue) {
    var WebGrid1 = ISGetObject(controlId);
    var rowIndex = WebGrid1.CheckedRowContext.rowIndex;

    if (!WebGrid1.RootTable.GetRow(rowIndex).ForceNoEdit) {
        window.setTimeout(
    function () {
        WebGrid1.RootTable.GetRow(rowIndex).Uncheck();
    }, 1);
    }

    return true;
}

The snippet code as shown in above uses “if” to check whether the ForceNoEdit property of current row is true or not. If true (disabled records), then uncheck the checkbox by invoking Uncheck() method.

Hope this helps.

All times are GMT -5. The time now is 9:28 PM.
Previous Next