Skip to content

[Feature request] Fillable but not editable columns #3116

Open
@dmtrKovalenko

Description

@dmtrKovalenko

My use case is a dropdown column where the user can immediately click on a column to select an option while also seeing drag to fill control, I am achieving this by using onRowChange of theformatter component.

image

But according to this line, https://github.com/adazzle/react-data-grid/blob/main/src/DragHandle.tsx#L92-L98 the drag-to-fill control do nothing if the editor is not specified (another question why render it at all if it is doing nothing)?

So I need to do something like this to make it work, while it still hides the fill control on double click into the field:

editor: function DropdownColumnFormatter({ row, onClose, onRowChange }) {
    return (
      <DropdownColumnSelect
        {...props}
        // This will open and focus dropdown on enter press in view mode or dblclick
        openOnMount
        row={row}
        onRowChange={row => { 
          console.log(row)
          onRowChange(row, true);
          onClose()
        }}
      />
    );
  },
  editorOptions: {
    renderFormatter: true,
  },
  formatter: function DropdownColumnFormatter({ row, onRowChange }) {
    return (
      <DropdownColumnSelect
        openOnMount={false}
        {...props}
        row={row}
        onRowChange={onRowChange}
      />
    );
  },

I would expect to not specify these props at all or just editable: true and still having an ability to change the row by filling without rendering editor

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions