Hi,
I have been trying to use the `DataPagerController` with my data table but I am unable to control anything with it. Is there currently an issue with the controller as to why it does not do any of the functions it has.
Thanks,
Will
Hi Will,
Based on the provided information, we are not able to reproduce your reported issue in a simple sample i.e., we have the DataGrid with two buttons. By pressing the button, we navigate to the next and previous page using the datapager controller. It’s working fine on our side. Please check the following code snippet and sample which we have tested.
Code Snippet:
|
final DataPagerController _dataPagerController = DataPagerController(); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( leading: const BackButton(), title: const Text('Syncfusion DataPager'), ), body: LayoutBuilder(builder: (context, constraints) { return Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ MaterialButton( onPressed: () { _dataPagerController.previousPage(); }, child: const Text('Move To Previous page'),
MaterialButton( onPressed: () { _dataPagerController.nextPage(); }, child: const Text('Move To Next page'), color: Colors.cyan), ], ), SizedBox( height: constraints.maxHeight - dataPagerHeight, child: SfDataGrid( source: _employeeDataSource, selectionMode: SelectionMode.multiple, columnWidthMode: ColumnWidthMode.fill, columns: getColumns), ), SizedBox( height: 60, child: SfDataPager( pageCount: ((_employees.length / _rowsPerPage).ceil()).toDouble(), direction: Axis.horizontal, delegate: _employeeDataSource, controller: _dataPagerController)) ], ); }), ); } |
Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/sample-535991697
Please check the above sample. Also, please ensure you have assigned the controller to the SfDataPager controller property. If you are still facing the same issue. We need more details about your reported issue to do further analysis to reproduce it. Can you please provide the following details?
Provide a sample that is reproducible.
Which use case are you
facing the issue with in the controller?
It will be helpful for us to check on it and provide you with the solution at the earliest.
We have already provided examples in our UG documentation. Please go through this,
UG documentation: https://help.syncfusion.com/flutter/datagrid/paging#programmatic-page-navigation
Regards,
Tamilarasan