DataGridController class
Controls a SfDataGrid widget.
This can be used to control the selection and current-cell operations such as programmatically select a row or rows, move the current-cell to required position.
DataGrid controllers are typically stored as member variables in State objects and are reused in each State.build.
- Inheritance
-
- Object
- ChangeNotifier
- DataGridSourceChangeNotifier
- DataGridController
Constructors
-
DataGridController({int selectedIndex = -1, DataGridRow? selectedRow, List<
DataGridRow> selectedRows = const <DataGridRow>[]}) -
Creates the DataGridController with the
selectedIndex
,selectedRow
andselectedRows
.
Properties
- currentCell → RowColumnIndex
-
A cell which is currently active.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- horizontalOffset → double
-
The current scroll offset of the horizontal scrollbar.
no setter
- isCurrentCellInEditing → bool
-
Whether the currently selected cell is in editing mode.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selectedIndex ↔ int
-
An index of the corresponding selected row.
getter/setter pair
- selectedRow ↔ DataGridRow?
-
An object of the corresponding selected row.
getter/setter pair
-
selectedRows
↔ List<
DataGridRow> -
The collection of objects that contains object of corresponding
to the selected rows in SfDataGrid.
getter/setter pair
- verticalOffset → double
-
The current scroll offset of the vertical scrollbar.
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
beginEdit(
RowColumnIndex rowColumnIndex) → Future< 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 will throw after the object is disposed).
inherited
-
endEdit(
) → Future< void> - Ends the current editing of a cell in SfDataGrid.
-
moveCurrentCellTo(
RowColumnIndex rowColumnIndex) → void - Moves the current-cell to the specified cell coordinates.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent 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.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
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