MudBlazor icon indicating copy to clipboard operation
MudBlazor copied to clipboard

MudTable "Select All" checkbox does not work correctly with MultiSelection and server-side pagination

Open neozhu opened this issue 4 years ago • 5 comments

https://try.mudblazor.com/snippet/QuGvuVQDezcmJxuz image

please, check it. when Server Side pagination, select all not working? click table header checkbox select current page rows, but not select head checkbox, so check again not change anything. if I want to unselect all that didn't it

Maybe it was done on purpose

neozhu avatar Jul 29 '21 12:07 neozhu

This is happening in 5.2.0 as well

squashleague avatar Nov 03 '21 00:11 squashleague

thank you for your information

neozhu avatar Nov 03 '21 05:11 neozhu

This is happening in 6.0.2 as well

franklupo avatar Dec 02 '21 17:12 franklupo

Also have this issue. Looking at the source, it makes sense, when data is paged with server data it's not possible to maintain SelectedItems as is currently done with non-server data. Not all items are known.

It would be difficult to extend the current multi-selection behavior of paged non-server data to paged server data. With non-server data, the "select all" checkbox selects items across all pages. With server data, it seems that the only reasonable thing to do here is for the "select all" checkbox to only apply to the current page.

I pulled MudBlazor and I currently have a solution that works as follows:

  • MudTable without ServerFunc behaves as it did before, where "select all" selects items across all pages
  • MudTable with ServerFunc only applies the "select all" checkbox to the current page, and selections across pages are still preserved.

The drawback here is the differing behavior for server/non-server data, but at least this would be a non-breaking change from a behavior standpoint.

Is it worth opening a PR to get this upstream?

andersstorhaug avatar Jan 21 '22 02:01 andersstorhaug

Also have this issue. Looking at the source, it makes sense, when data is paged with server data it's not possible to maintain SelectedItems as is currently done with non-server data. Not all items are known.

It would be difficult to extend the current multi-selection behavior of paged non-server data to paged server data. With non-server data, the "select all" checkbox selects items across all pages. With server data, it seems that the only reasonable thing to do here is for the "select all" checkbox to only apply to the current page.

I pulled MudBlazor and I currently have a solution that works as follows:

  • MudTable without ServerFunc behaves as it did before, where "select all" selects items across all pages
  • MudTable with ServerFunc only applies the "select all" checkbox to the current page, and selections across pages are still preserved.

The drawback here is the differing behavior for server/non-server data, but at least this would be a non-breaking change from a behavior standpoint.

Is it worth opening a PR to get this upstream?

I think that initial idea of selecting all elements in table is wrong. When paging MudTable without ServerFunc should manage selection per page too.

devrus91 avatar Apr 28 '22 01:04 devrus91