M
M
Mesuti2022-01-21 16:42:21
React
Mesuti, 2022-01-21 16:42:21

How to update state via custom component in AntDesign table?

Hey!
AntDesign table https://ant.design/components/table/#components-ta...
Question sandbox demo https://codesandbox.io/s/editable-cells-antd-4-18-...

On normal edit the state table is updated successfully.
How to update state on change <Select/>?61eab7d18274a294399654.gif

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mesuti, 2022-01-21
@Mesuti

render: (text, row, index) =>
...
onSelect={(e) => {
   row.key = index
   saveSelect()
}}>
...

function saveSelect(e) {
        setState(prevState => {
            return {
                ...prevState
            }
        })
    }

A
Aetae, 2022-01-21
@Aetae

Look at the code of the example you yourself gave the link to. See how much crap is written there? This is how React works.
If you want it to work like you wrote in the sandbox and even easier, without all this garbage, use Vue. In React, you can't do that - copy the example and figure it out.

V
Vladimir, 2022-01-21
@Casufi

EditableTable is your component or are you trying to figure out someone else's code?
It's just that what you wrote in the rendering of the select sheet and in the EditableTable does not fit, different levels.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question