doonfrs / pluto_grid_plus

PlutoGrid is a dataGrid for flutter that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS.
https://pluto.weblaze.dev
MIT License
18 stars 20 forks source link

[Help] how to avoid row value "null" display when data is null #19

Closed yunchiri closed 4 months ago

yunchiri commented 6 months ago
PlutoColumn(title: "id", field: "id", type: PlutoColumnType.text()),

when data value is ['1', null, '3']

image

how to replace "null" to empty

I have solution like

  List<PlutoColumn> columns = [
    PlutoColumn(
        title: "id",
        field: "id",
        type: PlutoColumnType.text(),
        formatter: (value) {
          if (value == null) return '';
          return value.toString();
        },
        readOnly: true),
  ];

but is there are simply way?

design2023 commented 6 months ago

You have to use the renderer property and return the Text widget with the value by checking the value before if it was null to view anything else.

doonfrs commented 4 months ago

renderer should give you full control of the cell widget, or you may change null to '' when you build the cells array ( alter the data )