igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

igx-grid rowSelectionChanging isSelectAll flag

Open mikerentmeister opened this issue 3 years ago • 11 comments

This is probably both a bug and feature request, because the igx-grid "select all" checkbox doesn't play nice with remote data sources

Is your feature request related to a problem? Please describe.

I am working on building an igx-grid with a remote data source (pretty much exactly like the examples, no paginator, but virtually scrolled), but I'm also adding row selections to the grid. One thing that I've noticed is that when you click the "select all" checkbox, it will only select the rows that the grid knows about at the time (whatever is loaded for the "page").

Describe the solution you'd like

The ability to know if the "select all" checkbox was clicked in the rowSelectionChanging event, and add the ability to handle the event asynchronously (promise/observable) to get the row keys of all items.

Describe alternatives you've considered

I have a work around by looking at the event's currentTarget, and seeing if it's the select all checkbox, but it would be nice to not have to do that just in case it changes in the future.

Additional context

My page size is 50, as you can see the grid thinks that all items are selected, but when I scroll down to load the other items, it's obviously not selected, because the grid knew nothing about that record other than it existing based on the totalItemCount

image

mikerentmeister avatar Feb 07 '22 19:02 mikerentmeister

Hey @mikerentmeister ,

You don't need to handle the event asynchronously. As long as you know that the header checkbox is clicked (which I agree should be more obvious), you can get your rowIds and directly set them in the selection service of the grid. It will also be more responsive to the end-user to allow the grid to select the visible ones and add the rest under the hood instead of waiting for the response for the initial click.

rowIds.foreach(rowID => this.grid.selectionService.rowSelection.add(rowID));

Not sure how much the private flag allRowsSelected affects the scenario though. @hanastasov and his team may be able to comment futher.

ChronosSF avatar Feb 08 '22 12:02 ChronosSF

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Apr 12 '22 00:04 github-actions[bot]

@mikerentmeister Could you comment on whether @ChronosSF's suggestion works for you, or you still need the flag in the event arguments?

kdinev avatar May 10 '22 11:05 kdinev

Yes, his suggestions should work for us

mikerentmeister avatar May 10 '22 12:05 mikerentmeister

In this case, I'm closing the issue :)

kdinev avatar May 10 '22 12:05 kdinev

@kdinev Apologies, I think I misunderstood your question. We still need some way of knowing whether the select all box was clicked, whether that's through a flag on the event, or a separate EventEmitter entirely. I meant that his suggestion would work for us in terms of loading our selected keys after selecting the visible ones, but his suggestion still relies on more work to be done on your side to let us know about the select all. Especially with the allRowsSelected flag he mentioned.

mikerentmeister avatar May 10 '22 12:05 mikerentmeister

@mikerentmeister Understood! Reopening :)

kdinev avatar May 10 '22 15:05 kdinev

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Jul 10 '22 00:07 github-actions[bot]

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Sep 10 '22 00:09 github-actions[bot]

@hanastasov Can you prioritize this bug into the current sprint?

kdinev avatar Sep 12 '22 07:09 kdinev

@hanastasov Can you prioritize this bug into the current sprint?

Yep, we're on it!

hanastasov avatar Sep 13 '22 08:09 hanastasov