bosskmk / pluto_grid

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.

Home Page:https://pluto.weblaze.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

when I created List<PlutoRow> Data programmatically, not working

johnzhu123 opened this issue · comments

handleDataSrc(List<dynamic> dataSrc) {
    final List<PlutoRow> rows = dataSrc.map((dynamic item) {
      Map<String, PlutoCell> cells = {};
      for (var key in item.keys) {
        if (item[key] != null) {
          cells[key] = PlutoCell(value: "${item[key]}");
        }
      }
      PlutoRow row = PlutoRow(cells: cells);
      return row;
    }).toList();
    return rows;
  }
 // this way will not work
 // var rows = handleDataSrc(widget.dataSrc);
 var rows = [
                PlutoRow(
                  cells: {
                    'id': PlutoCell(value: "6580910ddc65492c839bf6e9"),
                    'shipmentID': PlutoCell(value: 'xxx'),
                    'companyCode': PlutoCell(value: 'AAR'),
                    'shipmentETD': PlutoCell(value: 'xxxx'),
                    'shipmentETA': PlutoCell(value: 'xxxx'),
                    'createdAt': PlutoCell(value: '2021-01-01'),
                    'updatedAt': PlutoCell(value: 'xxxx'),
                  },
                )
              ];

I handle the data source in code, and I check the variables in side tabs, it's all ok, but the view will not show the data . don't know what's wrong.
if I write the rows literally, it will work! really need help !!! although I think it may be a tiny issue in code, many thanks!!

work:
image
not work with the rows shows below
image

image

1. The values have been checked for excluding null value

2. checked the pic above for the keys are totally matched