0

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!

tpeczek
  • 23,867
  • 3
  • 74
  • 77
user2723490
  • 2,010
  • 4
  • 27
  • 37

3 Answers3

3

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.

save_ole
  • 300
  • 1
  • 3
  • 10
0

The solution is:

$('#jqxGrid').jqxGrid('selectallrows');
scripto
  • 2,297
  • 1
  • 14
  • 13
  • Yes, it selects all rows and their checkboxes, but not the header box "Select All". Something weird, because to deselect all rows we would need to click twice on the header box. – user2723490 Sep 10 '13 at 09:43
0

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)
gf160
  • 21
  • 1
  • 2