Replies: 11 comments
-
I'll think about it, but I'm not sure it's feasible. The row rendering logic is quite complex. However, this is an excellent idea:
Thanks for the suggestion! I think adding row indexes to handlers would prove useful in many possible scenarios. |
Beta Was this translation helpful? Give feedback.
-
I know it's not exactly what you're asking for, but have a look at the row expansion feature. |
Beta Was this translation helpful? Give feedback.
-
Hi all, I was able to implement a sort inline edit, by using a |
Beta Was this translation helpful? Give feedback.
-
in short, I'm using something like ...
<DataTable
withBorder
borderRadius="md"
highlightOnHover
withColumnBorders
onRowClick={(_, rowIndex) => setSelectedRow(rowIndex)}
columns={[
{
accessor: "type",
width: 110,
render: (item: ItemForm) => {
const index = item.index || 0;
return (
<ItemTypePicker
key={`datatable-type-${index}`}
editable={selectedRow === index}
label={null}
{...form.getInputProps(`items.${index}.type`)}
/>
);
},
},
... but it doesn't help, I mean, the |
Beta Was this translation helpful? Give feedback.
-
Update: currently, the only way to handle any editable input inside a cell is by using a controlled component. That's because if you update the value by using |
Beta Was this translation helpful? Give feedback.
-
@gfazioli Related to your question above, I think it would be best if you could only render an |
Beta Was this translation helpful? Give feedback.
-
@icflorescu yep, would be a great alternative instead of using the |
Beta Was this translation helpful? Give feedback.
-
Let me explain what I suggested, once I had implemented an editable row with React Table Hook v8. Overall UI pattern looked something like below... The benefit of doing this way, table column schema can be separated entirely from the column UI itself. Improves the separation of concerns.
Then I passed the RowUI to DataTable as prop.
The Row UI prop was provided to At the end, it looked something like this... |
Beta Was this translation helpful? Give feedback.
-
@icflorescu - please let me know what you think. if you like this approach, I might help with a PR. |
Beta Was this translation helpful? Give feedback.
-
At a glance, it seems like a solid idea to me. More separation of concerns is always good. It seems like it could potentially break a bunch of stuff though, so any PR would have to be very thoroughly tested. |
Beta Was this translation helpful? Give feedback.
-
Hi was there any movement or developments in relation to row inline edits? I have a scenario where multiple cell's data can be edited on the row level and I'd like to set an isDirty flag to subsequently display a save icon in the actions column, or potentially whip through all dirty records and apply a bulk save. Thanks |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
The DataTable component does not support inline row edits. Inline edits are more desirable for enterprise-based applications. We can currently use the render props for each field separately. This is a length and code repetition that cannot be avoided. We always need to find an index to edit a row and update the state based on the current implementation.
Describe the solution you'd like
I would like to request a pattern where we can provide a RowComponent that implements the conditional logic if the row is being edited and renders the editable Row otherwise renders the default UI. It will be also best if we can get the row indexes as well with all event handlers so that we do not always iterate over the rows to find indexes.
Describe alternatives you've considered
Currently using render props to render editable UI vs Fixed UI.
Beta Was this translation helpful? Give feedback.
All reactions