This Knowledge base explains how to customize the behavior of the header checkbox when checkbox selection is used.
We have achieved this using rowSelecting and actionComplete events of ejGrid. By default, when the header checkbox is checked all the rows of the Grid will be selected.
If we need to select only specific rows based on some condition then we need to prevent the default behavior of the header checkbox in the rowSelecting event and bind a click event to the header checkbox.
The following code example demonstrates how to select only specific rows when header checkbox is checked.
1.Render the Grid control.
2. In rowSelecting event we prevent the default behavior of header checkbox by defining args.cancel as true and bind the click event to the header checkbox.
In the click event of header checkbox select the rows based on the required condition using selectRows method.
To maintain the selection in all the pages we need to call the header checkbox click handler in the actionComplete event.
This page will automatically be redirected to the sign-in page in 10 seconds.