Ben Siver
Ben Siver

Reputation: 2948

jqGrid: Expected Behavior for Checkboxes in Table Formatting

I am working with jqGrid to display a list of data. Each row has a checkbox on the leftmost side, with the top row acting as a column header. The checkbox on the leftmost side of the column header acts as a "Select All" button for all of the rows being displayed. In this scenario, if a user manually selects all of the checkboxes for each row, should the "Select All" checkbox automatically select itself?

See attached image for the checkbox in question.enter image description here

Upvotes: 1

Views: 347

Answers (3)

Siva Charan
Siva Charan

Reputation: 18064

You can do this way:-

$("#selectAll").click(function(){
    grid.jqGrid('resetSelection');
    var ids = grid.getDataIDs();
    for (var i=0, il=ids.length; i < il; i++) {
      grid.jqGrid('setSelection',ids[i], true);
    }
});

$("#clear").click(function(){
    grid.jqGrid('resetSelection');
});
​
  • This example is taken from here.

Upvotes: 1

In my point(and my customer's request also) of view, It is necessary. The main reason I want to make sure the header checkbox gets selected in my grids is so the user can subconsciously determine that yes, all the rows in the grid are definitely selected right now. If you consider, many rows in the jqgrid (some row are not visible) , how can i make sure all rows are selected (?).

Upvotes: 0

srini.venigalla
srini.venigalla

Reputation: 5145

Not necessary. It would be nice though.

Upvotes: 1

Related Questions