Correct table pages

This commit is contained in:
Hillel Coren 2021-11-13 22:49:03 +02:00
parent a6e1a81e44
commit 645b0241a2
2 changed files with 15 additions and 13 deletions

View File

@ -28,6 +28,18 @@ abstract class ListUIState implements Built<ListUIState, ListUIStateBuilder> {
@memoized @memoized
int get hashCode; int get hashCode;
int get tableHashCode =>
custom1Filters.hashCode ^
custom2Filters.hashCode ^
custom3Filters.hashCode ^
custom4Filters.hashCode ^
stateFilters.hashCode ^
statusFilters.hashCode ^
filterClearedAt.hashCode ^
filter.hashCode ^
sortAscending.hashCode ^
sortField.hashCode;
@nullable @nullable
String get filter; String get filter;

View File

@ -38,7 +38,9 @@ class EntityList extends StatefulWidget {
@required this.onClearMultiselect, @required this.onClearMultiselect,
this.presenter, this.presenter,
this.tableColumns, this.tableColumns,
}) : super(key: ValueKey('__${entityType}_${tableColumns}__')); }) : super(
key: ValueKey(
'__${entityType}_${tableColumns}_${state.uiState.filterEntityId}_${state.getUIState(entityType).listUIState.tableHashCode}__'));
final AppState state; final AppState state;
final EntityType entityType; final EntityType entityType;
@ -209,16 +211,6 @@ class _EntityListState extends State<EntityList> {
} }
final rowsPerPage = state.prefState.rowsPerPage; final rowsPerPage = state.prefState.rowsPerPage;
final listStateHash = listUIState.custom1Filters.hashCode ^
listUIState.custom2Filters.hashCode ^
listUIState.custom3Filters.hashCode ^
listUIState.custom4Filters.hashCode ^
listUIState.stateFilters.hashCode ^
listUIState.statusFilters.hashCode ^
listUIState.filterClearedAt.hashCode ^
listUIState.filter.hashCode ^
listUIState.sortAscending.hashCode ^
listUIState.sortField.hashCode;
return Column( return Column(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -241,8 +233,6 @@ class _EntityListState extends State<EntityList> {
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 16), padding: const EdgeInsets.symmetric(vertical: 16),
child: AppPaginatedDataTable( child: AppPaginatedDataTable(
key: ValueKey(
'__${uiState.filterEntityId}_${uiState.filterEntityType}_${listStateHash}__'),
onSelectAll: (value) { onSelectAll: (value) {
final startIndex = final startIndex =
min(_firstRowIndex, entityList.length - 1); min(_firstRowIndex, entityList.length - 1);