Reactjs: How to make all row checkbox check true when material table is loaded?
I am using react material table in my project and i want to make select all by default checked. How to achieve that??
function BasicSelection() {
return (
<MaterialTable
title="Basic Selection Preview"
columns={[
{ title: 'Name', field: 'name' },
{ title: 'Surname', field: 'surname' },
{ title: 'Birth Year', field: 'birthYear', type: 'numeric' },
{
title: 'Birth Place',
field: 'birthCity',
lookup: { 34: 'İstanbul', 63: 'Şanlıurfa' },
},
]}
data={[
{ name: 'a', surname: 'b', birthYear: c, birthCity: d },
{ name: 'e', surname: 'f', birthYear: g, birthCity: h },
]}
options={{
selection: true
}}
/>
)
}
You can add the following in each object of your data
tableData: { checked: true}
@dlopezd Hi! Where can i find all the props available por tableData? Do yo know if i can add data to row behind the scenes without "comitting" the line, something like "isEditing: true" ?
Hi @fofederico here is the doc: https://material-table.com/#/docs/all-props I haven't work yet editing data with material-table. I could not help you 😞
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.
.