79493965

Date: 2025-03-08 06:09:01
Score: 1
Natty:
Report link

use keyCreator. doc is here https://www.ag-grid.com/react-data-grid/provided-cell-editors-rich-select/#complex-objects

  const [columnDefs, setColumnDefs] = useState([
    {
      headerName: "Allow Typing (MatchAny)",
      field: "color",
      cellEditor: "agRichSelectCellEditor",
      keyCreator: params => params?.value?.label,
      cellEditorParams: {
        values: [{ label: "SpringGreen", value:1},
                 { label: "Tan", value:2},
                 { label: "SteelBlue" ,value:3} ],
        cellRenderer: (params) => {
          return <div>{params?.value?.label}</div>;
        },
        searchType: "matchAny",
        allowTyping: true,
        filterList: true,
        highlightMatch: true,
        valueListMaxHeight: 220,
      },
      valueFormatter: (params) => {
        return params.newValue?.label 
      },
    },
  ]);
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: liubin