angular-ui / ui-grid

UI Grid: an Angular Data Grid
http://ui-grid.info
MIT License
5.39k stars 2.46k forks source link

gridApi.selection.clearSelectedRows(); doesn't deselect group heading selection #3851

Open tiddle opened 9 years ago

tiddle commented 9 years ago
gridApi.selection.on.rowSelectionChanged($scope, function (row) {
   console.log(row.entity);
   gridApi.selection.clearSelectedRows();
});

This doesn't seems to clear the selection of group heading, but triggers this event

enableRowSelection: true,
enableGroupHeaderSelection: true,
enableRowHeaderSelection: false,
groupingShowCounts: false,
multiSelect: false,

The above are the options i had enabled.

You are also able to select more than 1 group heading. I'm not sure if this is intended.

My use case is: I want the group headings to act like another row, so when i select a group heading, it will be like i selected a normal row and deselect the previously selected row.

http://plnkr.co/edit/SCPMbOIlF4tNbB7MX0Hx?p=preview

ro0sterjam commented 9 years ago

I would like to see this resolved as well. How can one programatically deselect a group header at this time?

tiddle commented 9 years ago

The work around i did for this was to rearrange the data to include row headers in the data.

Which is not quite ideal but works.

Hypercubed commented 9 years ago

I'm having this same issue. Even with multiSelect: false row headers remain selected. I want selecting the row header to select all children, clearing other selections, including other row headers. I can't see how I can programmatically deselect a row header. selection.unSelectRow( rowHeader.entity ); doesn't do anything.

BillMiami0101 commented 8 years ago

I have the same issue where the group row headers remain selected when the gridApi.selection.clearSelectedRows() is called.

Has there been a resolution to this? Any other programmatic way to deselect group header rows?

gpalmer1984 commented 8 years ago

https://github.com/angular-ui/ui-grid/issues/4983

I found how to change the checkbox programmatically:

api.grid.treeBase.tree.forEach(function(branch){
    branch.row.isSelected = false;
});