Skip to content

configuration for english

kmk edited this page Dec 30, 2020 · 4 revisions

Configuration

When creating PlutoGrid you can change its settings by passing PlutoGridConfiguration in the configuration property.


var grid = PlutoGrid(
  columns: myData.columns,
  rows: myData.rows,
  configuration: PlutoGridConfiguration(
    enableColumnBorder: true,
    // ...
  ),
);

List of properties that can be added

Property name Description
enableColumnBorder Activate the vertical line between the column and the column.
gridBackgroundColor Set color on grid background.
gridBorderColor Sets the color of the grid border.
activatedColor Sets the color for the background of the currently active cell, row, or checkbox.
activatedBorderColor Sets the color for the border of the currently active cell, row, or checkbox.
checkedColor Sets the color for the background of selected rows.
borderColor Sets the color for the borders of rows or cells that are not active.
cellColorInEditState Sets the color of the background of the editing state cell.
cellColorInReadOnlyState Sets the color for the background of cells that are read-only.
columnTextStyle Set the text style of the column.
cellTextStyle Sets the cell's text style.
iconColor Sets the color of the icons used in the grid. (Column menu, icon to the right of popup type cell, etc.)
iconSize Sets the size of the icons used in the grid.
menuBackgroundColor Set the background color of the column menu popup.
rowHeight Set the height of the row.
enableMoveDownAfterSelecting After selecting a value from the selection popup (date, time, selection column), it automatically moves to the lower row.
enterKeyAction Set the operation of the Enter key.
localeText Set the text within the grid.
scrollbarConfig Set the settings of the scroll bar.
columnFilterConfig Set the filter on the column.

Detailed description

columnFilterConfig

Set by passing filters as an array to the filters property of columnFilterConfig.
If you define a callback function in the resolveDefaultColumnFilter property of columnFilterConfig, you can specify different default filters for each column.

class ClassYouImplemented implements PlutoFilterType {
  String get title => 'Custom contains';

  get compare => ({
    String base,
    String search,
    PlutoColumn column,
  }) {
    var keys = search.split(',').map((e) => e.toUpperCase()).toList();

    return keys.contains(base.toUpperCase());
  };

  const ClassYouImplemented();
}

var filterConfig = PlutoColumnFilterConfig(
  filters: const [
    ...FilterHelper.defaultFilters,
    // custom filter
    ClassYouImplemented(),
  ],
  resolveDefaultColumnFilter: (column, resolver) {
    if (column.field == 'text') {
      return resolver<PlutoFilterTypeContains>();
    } else if (column.field == 'number') {
      return resolver<PlutoFilterTypeGreaterThan>();
    } else if (column.field == 'date') {
      return resolver<PlutoFilterTypeLessThan>();
    } else if (column.field == 'select') {
      return resolver<ClassYouImplemented>();
    }

    return resolver<PlutoFilterTypeContains>();
  },
);