我有一个 PaginatedDataTable 和搜索栏,效果很好,但是当我搜索时,我的 DataTable 不会进入第一页。当我单击第一页时,它会显示第一页,并且显示我的新过滤列表。如何在 dataTable 中以编程方式更改页面?
这是我的分页数据表
PaginatedDataTable paginatedDataTable = PaginatedDataTable(
actions: [
AnimatedSearchBar(
width: 300,
textController: _searchController,
onSuffixTap: () {
setState(() {
_searchController.text = "";
});
}),
widget.showDialog == null
? SizedBox()
: AddUpdateButton(
buttonType: ButtonTypes.add,
onPressed: widget.showDialog,
)
],
initialFirstRowIndex: firstRowIndex,
source: dts,
rowsPerPage: _rowsPerPage,
header: Text(
widget.title,
style: CustomTextStyle.mblackBoldTextStyle,
),
sortColumnIndex: _sortColumnIndex,
sortAscending: _sortAscending,
availableRowsPerPage: [
_defaultRowsPerPage,
_defaultRowsPerPage * 2,
_defaultRowsPerPage * 5,
_defaultRowsPerPage * 10
],
showCheckboxColumn: false,
dataRowHeight: widget.dataRowHeight,
showFirstLastButtons: true,
onRowsPerPageChanged: (r) {
setState(() {
_rowsPerPage = r;
});
},
columns: widget.headerList.map((e) {
return DataColumn(
label: Text(e.name.toUpperCase()),
onSort: (int columnIndex, bool ascending) {
if (e.sort) {
return _sort(
(T d) => d.getProp(e.propName), columnIndex, ascending);
}
});
}).toList(),
);