Open Mahender-Kumar opened 4 days ago
pass the query to PaginatedDatatable and check if query is changed if it changes, jump to page no. 0 @override void didUpdateWidget(PaginatedTable oldWidget) { super.didUpdateWidget(oldWidget);
if (oldWidget.queryCHanged != widget.queryCHanged) {
// print('quwey changed');
oldWidget.source.removeListener(_handleDataSourceChanged);
widget.source.addListener(_handleDataSourceChanged);
_updateCaches();
pageTo(0);
}
if (oldWidget.source != widget.source) {
// print('source changed');
oldWidget.source.removeListener(_handleDataSourceChanged);
widget.source.addListener(_handleDataSourceChanged);
_updateCaches();
}
} please advise for a better solution and if it is wrong
Is there an existing issue for this?
What plugin is this bug for?
Firebase UI Firestore
What platform(s) does this bug affect?
No response
List of dependencies used.
flutter pub deps -s list
Steps to reproduce
class MyWidget extends ConsumerWidget { const MyWidget({super.key});
@override Widget build(BuildContext context, ref) { final usersQuery = FirebaseFirestore.instance .collection( 'users/${userId}/calls') .orderBy('timestamp', descending: true); return ListView( children: [ FirestoreDataTable( rowsPerPage: 20, dataRowMaxHeight: 40, dataRowMinHeight: 24, headingRowHeight: 40.0, columnSpacing: 24.0, showCheckboxColumn: false, query: usersQuery, showFirstLastButtons: true, columnLabels: { 'timestamp': const Text('Added On'), }, ), ], ); } }
Expected Behavior
if the query is changing the page should reset i.e. _rowindex should be set to 0
Actual Behavior
if the query is changing the page is not reseting i.e. _firstRowIndex is not setting to 0
Additional Information
No response