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.
https://pluto.weblaze.dev
MIT License
636 stars 290 forks source link

[Help] PlutoColumnType.select can assign object type right? #1015

Closed yaprogramming closed 3 months ago

yaprogramming commented 4 months ago

PlutoColumnType.select cannot select object value when item is object.

Example Setup PlutoColumn:

class DropdownType {
  String text;
  dynamic value;
  DropdownType({required this.text, required this.value});
}
final selectStatus = [
  DropdownType(text: 'YES', value: true),
  DropdownType(text: 'NO', value: false),
];
PlutoColumn(
    title: 'Status',
    field: 'isActive',
    type: PlutoColumnType.select(
      selectStatus,
      defaultValue: true,
    ),
    renderer: (rendererContext) {
      Color textColor = Colors.black;
      if (rendererContext.cell.value) {
        textColor = Colors.green;
      } else {
        textColor = Colors.red;
      }

      return Text(
        selectStatus.where((element) => element.value == rendererContext.cell.value).first.text,
        style: TextStyle(
          color: textColor,
        ),
      );
    },
  ),

Show in row success. Screenshot 2567-02-10 at 23 55 24

But select dropdown can't show object. Screenshot 2567-02-10 at 23 57 59

github-actions[bot] commented 3 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 3 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.