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

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!


Solution 1:

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.