md-data-table icon indicating copy to clipboard operation
md-data-table copied to clipboard

Select all only selects current view

Open seiyria opened this issue 9 years ago • 22 comments

It would be much better if it selected all applicable rows, even those not currently visible. Coupled with the prior issue I submitted, this means users would have to select a max of 15 people at once to operate on. Is there a way to override how the select all checkbox works?

seiyria avatar Sep 29 '15 03:09 seiyria

In what alternate universe is this a good thing " It would be much better if it selected all applicable users, even those not currently visible"

You may want to go read the spec for data-table.

joshwiens avatar Sep 29 '15 10:09 joshwiens

Suppose I filter down a table of 100 to a table of 30 via filter and I want to do an operation on all 30 of them at once. Currently I can't and I would like to. Doing it in multiple batches breaks the ux for me.

On Tue, Sep 29, 2015, 05:10 Joshua Wiens [email protected] wrote:

In what alternate universe is this a good thing " It would be much better if it selected all applicable users, even those not currently visible"

You may want to go read the spec for data-table.

— Reply to this email directly or view it on GitHub https://github.com/daniel-nagy/md-data-table/issues/142#issuecomment-144014178 .

seiyria avatar Sep 29 '15 12:09 seiyria

The problem with that is the element nor the user is aware of what the other 15 records are. I get the use case but I would argue against it being the default for "Select All"

IMO a better option would be

Select All: Selects all records currently displayed Select All Records (Needs a different name but you get the point): Explicit action to select every record in the returned set.

joshwiens avatar Sep 29 '15 12:09 joshwiens

And that'd be perfectly acceptable for me -- that's why I said I'd like to be able to override the select-all behavior to do this. In no way does it have to be the default.

seiyria avatar Sep 29 '15 12:09 seiyria

<--- Shouldn't have "skimmed"

joshwiens avatar Sep 29 '15 14:09 joshwiens

In this vein, it would also be nice to be able to select multiple entities across pages in the table.

seiyria avatar Oct 02 '15 13:10 seiyria

@daniel-nagy Any thoughts on this?

seiyria avatar Oct 14 '15 21:10 seiyria

+1 for a "Select All Records" feature

makkart avatar Nov 12 '15 22:11 makkart

+1

VivienZo avatar Feb 18 '16 15:02 VivienZo

I think the best I can do for this one is provide a callback for select all that would allow the developer to override the default behavior and manually select items. This is because if items are pull down from the server, in chunks, the table has no way of selecting items that haven't been pulled down yet.

daniel-nagy avatar Feb 18 '16 17:02 daniel-nagy

That's fine. In my case, I have all records on the client at all times, so I would like to select all of them when I hit select all, instead of just the current page.

seiyria avatar Feb 18 '16 17:02 seiyria

Would be perfect for my case, thanks! I work around this by putting a "select all records" button just above the data-table checkbox column. I used the "select_all" md-icon for this button to improve user understanding.

VivienZo avatar Feb 22 '16 13:02 VivienZo

This would be nice, especially since the reason for using this (for me at least) is for large datasets (2k+)

DarrylD avatar Mar 13 '16 13:03 DarrylD

I have a similar problem.

I'm using md-data-table with a md-virtual-repeat, which is like a better ng-repeat in terms of performance for large data sets.

It achieves so by instead of creating a new element for every single data in the set and then simply scrolling, like ng-repeat does, it uses a set number of divs on screen according to the available space and recycles them according to the scroll position, simply replacing the data inside with what's supposed to be showing in that position.

https://material.angularjs.org/latest/demo/virtualRepeat

The problem is that, as I could understand from the behavior of the data table, it sees this as filtered results, and when the user clicks on the "Select all" check box, in this case, it expects that all data in the set will be selected even the ones hidden by the overflow, but what is selected is only what is currently displayed, which "physically" is a reduced, or filtered, set but for the user it isn't. Note that this isn't filtering.

There is a filter function as well, which in this case, the checkbox works great, it selects only the filtered results, and if I remove the filter and display the entire set again, it keeps the filtered selection (as long as the filtered results fits in the space so it won't trigger the virtual repeater).

This is a case where overriding the checkbox function is needed. I believe the virtual repeater interferes with the selection logic.

brunofin avatar Mar 14 '16 13:03 brunofin

Has anyone got "Select All" scenario resolved, as in OP's question ?

JaySardhara avatar Nov 08 '16 00:11 JaySardhara

The best way is to allow the user to show all rows at once - say set the number of rows to 500. Then they will all get checked at once. Using gmail, if I click the select all checkbox, it only selects visible rows, so this is standard behavior. If you want to select more, show more on the page.

turbobuilt avatar Dec 07 '16 14:12 turbobuilt

@dtruel Gmail also allows you to select all items: https://puu.sh/sHfUR/0affe6cea2.png

This is the behavior that I wanted originally.

seiyria avatar Dec 07 '16 14:12 seiyria

@seiyria good point. But the default behavior of the CHECKBOXES is to only select what's visible. It would be very easy to just put a little link like the one in the picture that says check all. Then you just set $scope.selected= $scope.rows or something like that when clicked. i haven't tried it, but I bet that would work.

turbobuilt avatar Dec 08 '16 16:12 turbobuilt

It's been a year since I worked on the project that uses this, but I believe it did not. There was something that didn't work correctly.

seiyria avatar Dec 08 '16 16:12 seiyria

I can see 2 use cases:

  1. [relatively] small data set, but large enough to page It would be trivial to implement
$scope.selectAll = function() { $scope.table.selected = $scope.items;}
$scope.selectNone = function() { $scope.table.selected = [];}
  1. very large dataset It doesn't seem efficient to cache the full list again ($scope.table.selected = $scope.items;). table.selected: [] is an in-memory array. From a performance perspective you could simply execute the next step with a actionAll=true;, then reuse the original query-params and execute the next step. If you are lazyloading the list, then intercept the items as they come in and mark them all as 'selected' if required

dcolley avatar Mar 14 '17 15:03 dcolley

i didn't get any clear idea to solve above problem. how do i use select all

ArvindNikam76 avatar Jul 20 '17 07:07 ArvindNikam76

Help please what is callback for select all.

ArvindNikam76 avatar Jul 20 '17 12:07 ArvindNikam76