icflorescu / icflorescu/mantine-datatable

Inline cell editing

Open
#610 6 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
1.3k
Forks
102
PR merge metrics
No merged PRs in 30d

Description

In our implementation, we want to be able to add records to the array inline from the datatable, think of a structure of the table and at the bottom an "empty" row that works as a button that adds a new entry to the records. The way we do this now is that we use an unstyled button and use a transparent styling to indicate "interactivity".

However, what we can't yet do or figure out is inline cell value editing. I understand we can handle cell clicks but I'd rather make it that we can focus on the cell and have an input in them and then "save" the value to the records array once we unfocus the input

Some pseudo code to kind of illustrate what I mean


const records = [{name: 'row 1', some_val: 100}, {name: 'row2', some_val: 101}];

const create = () => {
    // push an "empty" record, or a default variant of a record
    records.push({name: '', some_val: 0})
}

// cellEdit are pseudo props - does not exist
<DataTable columns={table_columns} records={records} cellEditable />
<Button color="rgba(173, 173, 173, 1)" variant="transparent" onClick={create}>New record...</Button>

What would be recommended way of doing this?

I apologize before hand if there is already an issue or fix for this but after searching I can't seem to find a relevant issue or article in docs.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the DataTable API and the existing discussion on this issue, including the pseudo-TSX example. Identify whether inline cell editing and adding an empty row are supported entry points or require a new design; done should be defined as an agreed implementation path and documented behavior for editing and saving records.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.