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
664 stars 305 forks source link

[Help] How can I get the value of another cell from one cell in PlutoGrid #905

Closed jesussmile closed 1 year ago

jesussmile commented 1 year ago

Here, in the above Plutogrid I am trying to get the value of 2nd column cell when i click on any row in the same line

For example under 42 clearance if i tap on it i need to get the respective name in the NAME column,

this is my Plutogrid widget and i am using the onSelected call back to perform all logic operations. As the data is obtained from the server.

please help me update it

 Widget build(BuildContext context) {
    return SizedBox(
      width: MediaQuery.of(context).size.width,
      height: MediaQuery.of(context).size.height,
      child: PlutoGrid(
        configuration: const PlutoGridConfiguration(
          columnSize: PlutoGridColumnSizeConfig(
              resizeMode: PlutoResizeMode.pushAndPull),
        ),
        columns: [], // Empty list of columns.
        rows: [], // Empty list of rows.
        onSelected: (PlutoGridOnSelectedEvent event) {
          if (event.cell!.column.field == 'S/N' ||
              event.cell!.column.field == 'NAME' ||
              event.cell!.column.field == 'CODE') {
              //get the value of 2nd column adjacent cells ?

          } else {
            openDetail(event.cell, event.cell!.column.field);
            // print("object");
            // print(event.rowIdx);
          }
        },

        mode: PlutoGridMode.selectWithOneTap,
        onChanged: (PlutoGridOnChangedEvent event) {},
        onLoaded: (PlutoGridOnLoadedEvent event) {
          _stateManager = event
              .stateManager; // Updates the _stateManager object with the new state of the PlutoGrid.
          _updateGrid();
        },
      ),
    );
  }