Flutter, How can I change page programmaticly in PaginatedDataTable?


I have a PaginatedDataTable and searchbar, It’s work great but when I Searched my DataTable is not going to first page. When I click first Page its going first page and my new filtered list is showing. How can I change page programmaticly in dataTable?

This my PaginatedDataTable

    PaginatedDataTable paginatedDataTable = PaginatedDataTable(
    actions: [
          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(
      style: CustomTextStyle.mblackBoldTextStyle,
    sortColumnIndex: _sortColumnIndex,
    sortAscending: _sortAscending,
    availableRowsPerPage: [
      _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);


I create a key

final key = new GlobalKey<PaginatedDataTableState>();

Give key PaginatedDataTable

        key: key

and ı use this function


you can look this question for use key state :

Answered By – Şerefcan Oğuz

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *