SfDataGrid constructor
const
SfDataGrid({
- required DataGridSource source,
- required List<
GridColumn> columns, - Key? key,
- double rowHeight = double.nan,
- double headerRowHeight = double.nan,
- double defaultColumnWidth = double.nan,
- GridLinesVisibility gridLinesVisibility = GridLinesVisibility.horizontal,
- GridLinesVisibility headerGridLinesVisibility = GridLinesVisibility.horizontal,
- ColumnWidthMode columnWidthMode = ColumnWidthMode.none,
- ColumnSizer? columnSizer,
- ColumnWidthCalculationRange columnWidthCalculationRange = ColumnWidthCalculationRange.visibleRows,
- SelectionMode selectionMode = SelectionMode.none,
- int frozenColumnsCount = 0,
- int frozenRowsCount = 0,
- bool allowSorting = false,
- bool allowMultiColumnSorting = false,
- bool allowTriStateSorting = false,
- bool showSortNumbers = false,
- SortingGestureType sortingGestureType = SortingGestureType.tap,
- List<
StackedHeaderRow> stackedHeaderRows = const <StackedHeaderRow>[], - SelectionManagerBase? selectionManager,
- DataGridController? controller,
- QueryRowHeightCallback? onQueryRowHeight,
- SelectionChangedCallback? onSelectionChanged,
- SelectionChangingCallback? onSelectionChanging,
- CurrentCellActivatingCallback? onCurrentCellActivating,
- CurrentCellActivatedCallback? onCurrentCellActivated,
- DataGridCellTapCallback? onCellTap,
- DataGridCellDoubleTapCallback? onCellDoubleTap,
- DataGridCellTapCallback? onCellSecondaryTap,
- DataGridCellLongPressCallback? onCellLongPress,
- bool isScrollbarAlwaysShown = false,
- ScrollPhysics horizontalScrollPhysics = const AlwaysScrollableScrollPhysics(),
- ScrollPhysics verticalScrollPhysics = const AlwaysScrollableScrollPhysics(),
- LoadMoreViewBuilder? loadMoreViewBuilder,
- bool allowPullToRefresh = false,
- double refreshIndicatorDisplacement = 40.0,
- double refreshIndicatorStrokeWidth = 2.0,
- bool allowSwiping = false,
- double swipeMaxOffset = 200.0,
- ScrollController? horizontalScrollController,
- ScrollController? verticalScrollController,
- DataGridSwipeStartCallback? onSwipeStart,
- DataGridSwipeUpdateCallback? onSwipeUpdate,
- DataGridSwipeEndCallback? onSwipeEnd,
- DataGridSwipeActionsBuilder? startSwipeActionsBuilder,
- DataGridSwipeActionsBuilder? endSwipeActionsBuilder,
- bool highlightRowOnHover = true,
- bool allowColumnsResizing = false,
- ColumnResizeMode columnResizeMode = ColumnResizeMode.onResize,
- ColumnResizeStartCallback? onColumnResizeStart,
- ColumnResizeUpdateCallback? onColumnResizeUpdate,
- ColumnResizeEndCallback? onColumnResizeEnd,
- bool allowEditing = false,
- EditingGestureType editingGestureType = EditingGestureType.doubleTap,
- bool showCheckboxColumn = false,
- DataGridCheckboxColumnSettings checkboxColumnSettings = const DataGridCheckboxColumnSettings(),
- List<
GridTableSummaryRow> tableSummaryRows = const <GridTableSummaryRow>[], - int? rowsPerPage,
- bool shrinkWrapColumns = false,
- bool shrinkWrapRows = false,
- int? rowsCacheExtent,
- bool allowFiltering = false,
- DataGridFilterChangingCallback? onFilterChanging,
- DataGridFilterChangedCallback? onFilterChanged,
- OutlinedBorder? checkboxShape,
- bool showHorizontalScrollbar = true,
- bool showVerticalScrollbar = true,
- @Deprecated('use SfDataGrid.showColumnHeaderIconOnHover instead') bool showFilterIconOnHover = false,
- bool allowColumnsDragging = false,
- DataGridColumnDraggingCallback? onColumnDragging,
- ColumnDragFeedbackBuilderCallback? columnDragFeedbackBuilder,
- bool showColumnHeaderIconOnHover = false,
- bool autoExpandGroups = true,
- bool allowExpandCollapseGroup = false,
- GroupChangingCallback? groupExpanding,
- GroupChangedCallback? groupExpanded,
- GroupChangingCallback? groupCollapsing,
- GroupChangedCallback? groupCollapsed,
- String groupCaptionTitleFormat = '{ColumnName} : {Key} - {ItemsCount} Items',
Creates a widget describing a datagrid.
The columns
and source
argument must be defined and must not be null.
Implementation
const SfDataGrid({
required this.source,
required this.columns,
Key? key,
this.rowHeight = double.nan,
this.headerRowHeight = double.nan,
this.defaultColumnWidth = double.nan,
this.gridLinesVisibility = GridLinesVisibility.horizontal,
this.headerGridLinesVisibility = GridLinesVisibility.horizontal,
this.columnWidthMode = ColumnWidthMode.none,
this.columnSizer,
this.columnWidthCalculationRange = ColumnWidthCalculationRange.visibleRows,
this.selectionMode = SelectionMode.none,
this.navigationMode = GridNavigationMode.row,
this.frozenColumnsCount = 0,
this.footerFrozenColumnsCount = 0,
this.frozenRowsCount = 0,
this.footerFrozenRowsCount = 0,
this.allowSorting = false,
this.allowMultiColumnSorting = false,
this.allowTriStateSorting = false,
this.showSortNumbers = false,
this.sortingGestureType = SortingGestureType.tap,
this.stackedHeaderRows = const <StackedHeaderRow>[],
this.selectionManager,
this.controller,
this.onQueryRowHeight,
this.onSelectionChanged,
this.onSelectionChanging,
this.onCurrentCellActivating,
this.onCurrentCellActivated,
this.onCellTap,
this.onCellDoubleTap,
this.onCellSecondaryTap,
this.onCellLongPress,
this.isScrollbarAlwaysShown = false,
this.horizontalScrollPhysics = const AlwaysScrollableScrollPhysics(),
this.verticalScrollPhysics = const AlwaysScrollableScrollPhysics(),
this.loadMoreViewBuilder,
this.allowPullToRefresh = false,
this.refreshIndicatorDisplacement = 40.0,
this.refreshIndicatorStrokeWidth = 2.0,
this.allowSwiping = false,
this.swipeMaxOffset = 200.0,
this.horizontalScrollController,
this.verticalScrollController,
this.onSwipeStart,
this.onSwipeUpdate,
this.onSwipeEnd,
this.startSwipeActionsBuilder,
this.endSwipeActionsBuilder,
this.highlightRowOnHover = true,
this.allowColumnsResizing = false,
this.columnResizeMode = ColumnResizeMode.onResize,
this.onColumnResizeStart,
this.onColumnResizeUpdate,
this.onColumnResizeEnd,
this.allowEditing = false,
this.editingGestureType = EditingGestureType.doubleTap,
this.footer,
this.footerHeight = 49.0,
this.showCheckboxColumn = false,
this.checkboxColumnSettings = const DataGridCheckboxColumnSettings(),
this.tableSummaryRows = const <GridTableSummaryRow>[],
this.rowsPerPage,
this.shrinkWrapColumns = false,
this.shrinkWrapRows = false,
this.rowsCacheExtent,
this.allowFiltering = false,
this.onFilterChanging,
this.onFilterChanged,
this.checkboxShape,
this.showHorizontalScrollbar = true,
this.showVerticalScrollbar = true,
@Deprecated('use SfDataGrid.showColumnHeaderIconOnHover instead')
this.showFilterIconOnHover = false,
this.allowColumnsDragging = false,
this.onColumnDragging,
this.columnDragFeedbackBuilder,
this.showColumnHeaderIconOnHover = false,
this.autoExpandGroups = true,
this.allowExpandCollapseGroup = false,
this.groupExpanding,
this.groupExpanded,
this.groupCollapsing,
this.groupCollapsed,
this.groupCaptionTitleFormat = '{ColumnName} : {Key} - {ItemsCount} Items',
}) : assert(frozenColumnsCount >= 0),
assert(footerFrozenColumnsCount >= 0),
assert(frozenRowsCount >= 0),
assert(footerFrozenRowsCount >= 0),
super(key: key);