md-data-table
md-data-table copied to clipboard
Select all only selects current view
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?
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.
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 .
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.
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.
<--- Shouldn't have "skimmed"
In this vein, it would also be nice to be able to select multiple entities across pages in the table.
@daniel-nagy Any thoughts on this?
+1 for a "Select All Records" feature
+1
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.
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.
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.
This would be nice, especially since the reason for using this (for me at least) is for large datasets (2k+)
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 div
s 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.
Has anyone got "Select All" scenario resolved, as in OP's question ?
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.
@dtruel Gmail also allows you to select all items: https://puu.sh/sHfUR/0affe6cea2.png
This is the behavior that I wanted originally.
@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.
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.
I can see 2 use cases:
- [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 = [];}
- 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 aactionAll=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
i didn't get any clear idea to solve above problem. how do i use select all
Help please what is callback for select all.