Cell Editing
To setup cell editing set the cellEditable flag on the grid
and specify editor widget configurations for all editable columns.
If some of the cells should not be editable, disable editing using the editable property.
Use the onCellEdited callback to react on changes, e.g. update the record in the database.
For grids with many records it is recommended to use buffering for optimal performance.
| # | Name | Continent | Browser | OS | Visits |
|---|---|---|---|---|---|
| 0 | Elwyn Mann | North America | Safari | iOS | 44 |
| 1 | Clare Lindgren | Australia | Chrome | Ubuntu | 30 |
| 2 | Mozelle Hickle | South America | Safari | Mac OS | 15 |
| 3 | Stefanie Crona | Antarctica | Opera | Mac OS | 58 |
| 4 | Aliya Nikolaus | Africa | Opera | Windows | 85 |
| 5 | Amely Yundt | South America | Opera | Windows | 85 |
| 6 | Neha Skiles | Europe | Safari | Ubuntu | 75 |
| 7 | Leopold Cruickshank | Asia | Safari | Ubuntu | 61 |
| 8 | Oran Wiegand | North America | Internet Explorer | Android | 39 |
| 9 | Trudie Pollich | South America | Safari | Mac OS | 70 |
| 10 | Kristin Mosciski | North America | Internet Explorer | Mac OS | 73 |
| 11 | Lucie Schmeler | Asia | Safari | Windows | 65 |
| 12 | Cletus Parker | Africa | Internet Explorer | Android | 53 |
| 13 | Jace Casper | North America | Safari | Ubuntu | 9 |
| 14 | Willa Flatley | Antarctica | Chrome | Android | 42 |
| 15 | Pamela Kautzer | Africa | Safari | iOS | 9 |
| 16 | Deon Bartoletti | Asia | Firefox | iOS | 83 |
| 17 | Orion Hansen | Antarctica | Firefox | Windows | 45 |
| 18 | Shaina Cartwright | Australia | Edge | Ubuntu | 45 |
| 19 | Carissa Reichel | Africa | Internet Explorer | Android | 32 |
| 20 | Nikolas Trantow | North America | Edge | Android | 15 |
| 21 | Vesta Wisoky | South America | Safari | iOS | 32 |
| 22 | Ona Emard | South America | Safari | Ubuntu | 8 |
| 23 | Itzel Deckow | North America | Chrome | Mac OS | 57 |
| 24 | Phoebe Green | Antarctica | Safari | Ubuntu | 62 |
| 25 | Zoey Pacocha | Antarctica | Firefox | Android | 66 |
| 26 | Katheryn Kuhic | Australia | Internet Explorer | Android | 73 |
| 27 | Elissa Hartmann | South America | Safari | Mac OS | 87 |
| 28 | Marianna Marvin | Africa | Chrome | Android | 28 |
| 29 | Mabelle Osinski | Africa | Firefox | iOS | 60 |
| 30 | Sienna Emard | North America | Opera | Mac OS | 89 |
| 31 | Crystel Baumbach | Antarctica | Firefox | Ubuntu | 89 |
| 32 | Scot Schroeder | Africa | Internet Explorer | Mac OS | 64 |
| 33 | Kristian Renner | Australia | Safari | Android | 99 |
| 34 | Dustin Bode | Asia | Internet Explorer | Ubuntu | 35 |
| 35 | Dolly Koelpin | North America | Firefox | Android | 65 |
| 36 | Madelyn Prosacco | Africa | Chrome | Mac OS | 47 |
| 37 | Iliana Fisher | Asia | Firefox | Mac OS | 74 |
| 38 | Brenda Welch | Africa | Edge | Mac OS | 94 |
| 39 | Tessie Parker | Asia | Firefox | Android | 55 |
| 40 | Arvilla Purdy | Africa | Chrome | Android | 80 |
| 41 | Davonte Hoeger | Europe | Internet Explorer | Ubuntu | 77 |
| 42 | Sydnie Kuphal | North America | Edge | iOS | 39 |
| 43 | Karl Murazik | Australia | Opera | Android | 38 |
| 44 | Renee Lehner | Europe | Chrome | Mac OS | 98 |
| 45 | Adolf Bednar | Africa | Edge | Mac OS | 63 |
| 46 | Margie Fritsch | Australia | Edge | Android | 25 |
| 47 | Corbin West | Asia | Edge | Android | 48 |
| 48 | Dorothea Kling | Africa | Opera | Mac OS | 93 |
| 49 | Dana Robel | Europe | Chrome | Android | 74 |
| 50 | Annie Bradtke | Antarctica | Chrome | Mac OS | 68 |
| 51 | Abdul Dooley | Asia | Edge | Windows | 73 |
| 52 | Crystal Mayer | North America | Opera | Ubuntu | 37 |
| 53 | Parker Kiehn | Antarctica | Opera | Mac OS | 12 |
| 54 | River Wiegand | Australia | Opera | Mac OS | 32 |
| 55 | Marisa Greenfelder | Australia | Internet Explorer | Android | 78 |
| 56 | Joany Wiegand | North America | Chrome | Ubuntu | 37 |
| 57 | Joana Torp | Australia | Opera | Windows | 3 |
| 58 | Abdiel Harber | Asia | Chrome | Windows | 96 |
| 59 | Percy Welch | Asia | Opera | Android | 72 |
| # | Name | Continent | Browser | OS | Visits |
|---|
Index
<Grid
cellEditable
onCellEdited={(change, record) => {
console.log(change, record);
}}
records-bind="$page.records"
scrollable
buffered
style="height: 600px;"
lockColumnWidths
cached
columns={
[
{header: "#", field: "index", sortable: true, value: {bind: "$index"}},
{
header: "Name",
field: "fullName",
sortable: true,
editor: <cx>
<TextField
value-bind="$record.fullName"
style="position: absolute; width: 100%; height: 100%; top: 0;"
required
visited
/>
</cx>
},
{
header: "Continent", field: "continent", sortable: true,
editor: <cx>
<Select
value-bind="$record.continent"
style="position: absolute; width: 100%; height: 100%; top: 0;"
required
>
<option value="Africa">Africa</option>
<option value="Antarctica">Antarctica</option>
<option value="Asia">Asia</option>
<option value="Australia">Australia</option>
<option value="Europe">Europe</option>
<option value="North America">North America</option>
<option value="South America">South America</option>
</Select>
</cx>
},
{
header: "Browser", field: "browser", sortable: true,
editor: <cx>
<LookupField
value-bind="$record.browser"
style="position: absolute; width: 100%; height: 100%; top: 0;"
required
autoOpen
options={[
{ id: "Opera", text: "Opera" },
{ id: "Safari", text: "Safari" },
{ id: "Chrome", text: "Chrome" },
{ id: "Firefox", text: "Firefox" },
{ id: "Edge", text: "Edge" },
{ id: "Internet Explorer", text: "Internet Explorer" }
]}
/>
</cx>
},
{
header: "OS", field: "os", sortable: true,
editor: <cx>
<LookupField
value-bind="$record.os"
style="position: absolute; width: 100%; height: 100%; top: 0;"
required
autoOpen
options={[
{ id: "Mac OS", text: "Mac OS" },
{ id: "iOS", text: "iOS" },
{ id: "Android", text: "Android" },
{ id: "Windows", text: "Windows" },
{ id: "Ubuntu", text: "Ubuntu" },
]}
/>
</cx>
},
{
header: "Visits",
field: "visits",
sortable: true,
align: "right",
editor: <cx>
<NumberField
value-bind="$record.visits"
style="position: absolute; width: 100%; height: 100%; top: 0;"
required
visited
inputStyle="text-align: right"
/>
</cx>
}
]
}
/>