DataGridController class Null safety

Controls a SfDataGrid widget.

This can be used to control the selection and currentcell operations such as programmatically select a row or rows, move the currentcell to required position.

DataGrid controllers are typically stored as member variables in State objects and are reused in each State.build.

Inheritance

Constructors

DataGridController({int selectedIndex = -1, DataGridRow? selectedRow, List<DataGridRow> selectedRows = const <DataGridRow>[]})
Creates the DataGridController with the selectedIndex, selectedRow and selectedRows.

Properties

currentCell RowColumnIndex
A cell which is currently active. [...]
read-only
hashCode int
The hash code for this object. [...]
read-only, inherited
hasListeners bool
Whether any listeners are currently registered. [...]
@protected, read-only, inherited
horizontalOffset double
The current scroll offset of the horizontal scrollbar.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
selectedIndex int
An index of the corresponding selected row.
read / write
selectedRow DataGridRow?
An object of the corresponding selected row. [...]
read / write
selectedRows List<DataGridRow>
The collection of objects that contains object of corresponding to the selected rows in SfDataGrid.
read / write
verticalOffset double
The current scroll offset of the vertical scrollbar.
read-only

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes. [...]
inherited
beginEdit(RowColumnIndex rowColumnIndex) → void
Begins the edit to the given RowColumnIndex in SfDataGrid.
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener and removeListener will throw after the object is disposed). [...]
@mustCallSuper, inherited
endEdit() → void
Ends the current editing of a cell in SfDataGrid.
moveCurrentCellTo(RowColumnIndex rowColumnIndex) → void
Moves the currentcell to the specified cell coordinates.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
notifyDataSourceListeners({RowColumnIndex? rowColumnIndex}) → void
Calls all the datagrid source listeners. Call this method whenever the underlying data is added or removed. If the value of the specific cell is updated, call this method with RowColumnIndex argument where it refers the corresponding row and column index of the cell.
@protected, inherited
notifyListeners() → void
Call all the registered listeners. [...]
@protected, inherited
refreshRow(int rowIndex, {bool recalculateRowHeight = false}) → void
If the rowIndex alone is given, the entire row will be set as dirty. So, data which is displayed in a row will be refreshed. You can call this method when the data is updated in row in underlying datasource. [...]
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes. [...]
inherited
scrollToCell(double rowIndex, double columnIndex, {bool canAnimate = false, DataGridScrollPosition rowPosition = DataGridScrollPosition.start, DataGridScrollPosition columnPosition = DataGridScrollPosition.start}) Future<void>
Scrolls the SfDataGrid to the given row and column index. [...]
scrollToColumn(double columnIndex, {bool canAnimate = false, DataGridScrollPosition position = DataGridScrollPosition.start}) Future<void>
Scrolls the SfDataGrid to the given column index. [...]
scrollToHorizontalOffset(double offset, {bool canAnimate = false}) Future<void>
Scroll the horizontal scrollbar from current value to the given value. [...]
scrollToRow(double rowIndex, {bool canAnimate = false, DataGridScrollPosition position = DataGridScrollPosition.start}) Future<void>
Scrolls the SfDataGrid to the given index. [...]
scrollToVerticalOffset(double offset, {bool canAnimate = false}) Future<void>
Scroll the vertical scrollbar from current position to the given value. [...]
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited