Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AsyncDataTableSource.selectAll() seems that not update _selectionRowKeys correctly #275

Open
MarcoLuciani-94 opened this issue Apr 13, 2024 · 0 comments

Comments

@MarcoLuciani-94
Copy link

in a AsyncPaginatedDataTable2 with AsyncDataTableSource class, seems that on selectAll(), function don't insert all Keys inside _selectionRowKeys object.

for example, take a table with 7 elements:

AsyncPaginatedDataTable2(
                    empty:Center(
                    child: Container(
                        padding: const EdgeInsets.all(20),
                        color: Colors.grey[200],
                        child: const Text('No data'))),
                    columnSpacing: 12,
                    horizontalMargin: 12,
                    columns: columns,
                    loading: _Loading(),
                    onSelectAll: (select) {
                      if (select != null && select) {
                        dataSource!.selectAll();
                      }
                      if (select != null && !select) {
                        dataSource!.deselectAll();
                      }},
                    source: dataSource!,
                    rowsPerPage: 5, // Number of rows per page
                    availableRowsPerPage: const [2, 5, 10, 30, 100],
                    showCheckboxColumn: true,
                    showFirstLastButtons: true,
                    checkboxHorizontalMargin: 12,
                    wrapInCard: false,
                    renderEmptyRowsInTheEnd: false,
                    controller: _controller,
                    ),

i obtain those results:

print(dataSource!.selectedRowCount); \\ 7
  print(dataSource!.selectionRowKeys); \\ 0

looking on

there is:

 void selectAll() {
    _selectionState = SelectionState.exclude;
    _selectionRowKeys.clear();
    notifyListeners();
  }

is correct that system clear the list, but maybe after it maybe need to add all element again? or there is another approach or method to obtain Keys list?
On UI side, everything work fine and also count work.
Thanks
Marco

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant