PaginatedDataTable constructor

PaginatedDataTable({Key key, @required Widget header, List<Widget> actions, @required List<DataColumn> columns, int sortColumnIndex, bool sortAscending: true, ValueSetter<bool> onSelectAll, int initialFirstRowIndex: 0, ValueChanged<int> onPageChanged, int rowsPerPage: defaultRowsPerPage, List<int> availableRowsPerPage: const [defaultRowsPerPage, defaultRowsPerPage * 2, defaultRowsPerPage * 5, defaultRowsPerPage * 10], ValueChanged<int> onRowsPerPageChanged, DragStartBehavior dragStartBehavior: DragStartBehavior.start, @required DataTableSource source })

Creates a widget describing a paginated DataTable on a Card.

The header should give the card's header, typically a Text widget. It must not be null.

The columns argument must be a list of as many DataColumn objects as the table is to have columns, ignoring the leading checkbox column if any. The columns argument must have a length greater than zero and cannot be null.

If the table is sorted, the column that provides the current primary key should be specified by index in sortColumnIndex, 0 meaning the first column in columns, 1 being the next one, and so forth.

The actual sort order can be specified using sortAscending; if the sort order is ascending, this should be true (the default), otherwise it should be false.

The source must not be null. The source should be a long-lived DataTableSource. The same source should be provided each time a particular PaginatedDataTable widget is created; avoid creating a new DataTableSource with each new instance of the PaginatedDataTable widget unless the data table really is to now show entirely different data from a new source.

The rowsPerPage and availableRowsPerPage must not be null (they both have defaults, though, so don't have to be specified).

Implementation

PaginatedDataTable({
  Key key,
  @required this.header,
  this.actions,
  @required this.columns,
  this.sortColumnIndex,
  this.sortAscending = true,
  this.onSelectAll,
  this.initialFirstRowIndex = 0,
  this.onPageChanged,
  this.rowsPerPage = defaultRowsPerPage,
  this.availableRowsPerPage = const <int>[defaultRowsPerPage, defaultRowsPerPage * 2, defaultRowsPerPage * 5, defaultRowsPerPage * 10],
  this.onRowsPerPageChanged,
  this.dragStartBehavior = DragStartBehavior.start,
  @required this.source,
}) : assert(header != null),
     assert(columns != null),
     assert(dragStartBehavior != null),
     assert(columns.isNotEmpty),
     assert(sortColumnIndex == null || (sortColumnIndex >= 0 && sortColumnIndex < columns.length)),
     assert(sortAscending != null),
     assert(rowsPerPage != null),
     assert(rowsPerPage > 0),
     assert(() {
       if (onRowsPerPageChanged != null)
         assert(availableRowsPerPage != null && availableRowsPerPage.contains(rowsPerPage));
       return true;
     }()),
     assert(source != null),
     super(key: key);