We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to customize select all checkbox behavior in grid header

This Knowledge base explains how to customize the behavior of the header checkbox when checkbox selection is used.

Solution:

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.

HTML

JavaScript

MVC

ASPX

 

ASP.NET CORE

 

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.

JS

 

Result:

Article ID: Published Date: Last Revised Date: Platform: Control:
8968 07/13/2018 07/13/2018 JavaScript ejGrid
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.