jQuery and jqxGrid - how to select all rows in jqxGrid via checkboxes

5.5k Views Asked by At

How can I check all rows of jQWidgets jqxGrid with checkbox options programmatically‎? I can loop through rows and select them one-by-one or use

$("#jqxgrid").jqxGrid('selectallrows');

but I need to make a selection via the checkbox option - see

http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm?%28arctic%29#demos/jqxgrid/checkboxselection.htm

Basically I need to replicate a click on the top "Select All" checkbox.

How can I do this?

Thanks!

3

There are 3 best solutions below

1
On BEST ANSWER

The solution is:

$('#jqxGrid').jqxGrid('selectallrows');
0
On

how about this?

var rows = $('#grid').jqxGrid('getRows');
for(var i = 0 ; i < rows.length ; i++){
    var _item = rows[i];
    $('#grid').jqxGrid('setcellvaluebyid', _item.boundindex, "[YOUR COLUMN]", true);
}//for end(i)
0
On

Here's the solution:

$('#jqxGrid').jqxGrid({ selectionmode: 'checkbox'}); 

This will add a new column at the beginning for the checkboxes and a box for 'checkall' action.