Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cell inline edits #249

Closed
zbraniecki opened this issue Apr 12, 2023 · 2 comments
Closed

Cell inline edits #249

zbraniecki opened this issue Apr 12, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@zbraniecki
Copy link

Describe the solution you'd like

This is similar to #79 but tailored down to making a single cell editable.

Screen.Recording.2023-04-11.at.5.50.34.PM.mov

The way I achieved it is by specifying a custom render function on a column:

      render: (item) => {
        let matching = false;
        if (editableCell !== null) {
          if (editableCell.id === item.id && editableCell.accessor === 'name') {
            matching = true;
          }
        }
        if (!matching) {
          return item.name;
        }
        return (
          <TextInput 
            placeholder={"name"}
            variant="unstyled"
            sx={{
              "& input": {
                lineHeight: 'normal',
                height: 'auto',
                minHeight: 'auto',
              }
            }}
            value={editableCellValue}
            onChange={(e) => setEditableCellValue(e.currentTarget.value)}
            ref={focusTrapRef}
            onKeyDown={onEditableCellKey}
          ></TextInput>
        );
      },
    },

This is quite unintuitive and I had to combine it with onClick to set editable cell rowId/columnId.

It would be great to be able to make a column as editable (preferably for some rows, not always for all) and handle editable/readonly states.

@icflorescu
Copy link
Owner

I like how it looks. Would you be willing to come up with a PR? :-)
Same for #248

Thanks a lot!

@icflorescu icflorescu added the enhancement New feature or request label Apr 13, 2023
@icflorescu
Copy link
Owner

Closing due to inactivity.

@icflorescu icflorescu closed this as not planned Won't fix, can't repro, duplicate, stale Aug 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants