Controlled Editing Mode #163
matthewoestreich
started this conversation in
Ideas
Replies: 1 comment 3 replies
-
@peacechen isn't that already possible, or am I missing something? function EditableRow(props) {
const [isEditing, setIsEditing] = useState(false);
return (
<div>
<p>I am the parent</p>
<button onClick={(e) => setIsEditing(!isEditing)}>
{isEditing ? 'Disable' : 'Enable'} Editing
</button>
<MaterialTable
editable={{
isEditable: () => isEditing,
onRowUpdate: (newData, oldData) =>
new Promise((resolve, reject) => setTimeout(() => resolve(), 1000))
}}
data={[
{ name: 'jack', id: 1 },
{ name: 'nancy', id: 2 }
]}
columns={[
{ field: 'name', title: 'Name' },
{ field: 'id', title: 'Identifier' }
]}
/>
</div>
);
} |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From @peacechen
Beta Was this translation helpful? Give feedback.
All reactions