Webgrid 7 checkbox column type setting value, for all rows

Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback

Hello,

 

I'm looking for setting all checkbox values (on my first column - column type checkbox).

 

I would like to do that client-side and I'm using JavaScript. I found a sample "Using Checkbox combined with client-side programming" :

function selectAll()
{
    // get an instance of the WebGrid
    var grid = wgGetGridById("WebGrid1");
    
    // collect all checkboxes
    // get all rows element of the WebGrid
    var rows = grid.Tables["Categories"].gettbTBElement().rows;
    
    // iterate through all rows
    for (var i=0; i< rows.length; i++)
    {
        if (rows[i].type == "Record")
        {
            // get the first column of the current row (checkbox)
            var cell = wgGetCellByPosition(rows[i], 0);
            cell.childNodes[0].checked = true;
        }
    }
}

All this function work well except the cell.childNodes[0].checked = true instruction. I get an error "childNodes.0" is null or not an object...


Do you have any ideas ?

Nicolas

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