You're viewing the legacy site. Visit cxjs.io/docs for the latest documentation. Legacy site. Visit cxjs.io/docs for new docs.

Documentation

Report Edit

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.

#NameContinentBrowserOSVisits
0Breanna FramiSouth AmericaOperaAndroid67
1Dewayne BoganAfricaOperaMac OS63
2Destinee GulgowskiNorth AmericaSafariUbuntu77
3Sigurd HudsonNorth AmericaSafariWindows33
4Cecile StrackeNorth AmericaSafariUbuntu1
5Veronica CollierEuropeFirefoxAndroid61
6Enos BaileyAsiaOperaWindows86
7Ashleigh McDermottEuropeChromeWindows38
8Arvilla KochAfricaFirefoxMac OS31
9Curt DoyleNorth AmericaInternet ExplorerUbuntu5
10Vincenzo KutchSouth AmericaSafariiOS35
11Patience WuckertNorth AmericaFirefoxUbuntu3
12Genevieve WolffAsiaChromeAndroid1
13Marietta BodeAustraliaFirefoxMac OS27
14Franco ReynoldsAustraliaEdgeWindows63
15Markus RobelSouth AmericaOperaMac OS74
16Art HyattNorth AmericaInternet ExplorerWindows92
17Nasir EmmerichAntarcticaInternet ExplorerUbuntu70
18Carroll SchneiderAfricaInternet ExplorerWindows87
19Eloise SmithamAntarcticaSafariMac OS99
20Curtis AltenwerthSouth AmericaSafariAndroid90
21Jess SporerSouth AmericaInternet ExplorerWindows18
22Jody AdamsAustraliaEdgeMac OS59
23Bennett BrownAustraliaSafariMac OS92
24Boyd HaleyNorth AmericaInternet ExplorerUbuntu41
25Dustin RyanEuropeSafariMac OS5
26Easter LoweNorth AmericaEdgeWindows39
27Hailee RutherfordAfricaEdgeUbuntu4
28Corbin McGlynnAsiaChromeMac OS56
29Nelle JohnsonNorth AmericaEdgeiOS49
30Destiny StantonSouth AmericaInternet ExploreriOS71
31Brycen CasperNorth AmericaEdgeMac OS78
32Wyatt BrekkeAsiaEdgeMac OS33
33Lauren BaumbachAntarcticaFirefoxWindows4
34Amie BotsfordSouth AmericaOperaAndroid49
35Beverly SchaeferSouth AmericaInternet ExploreriOS8
36Gerson NolanAfricaInternet ExplorerUbuntu18
37Colt KreigerEuropeOperaWindows38
38Clifton KerlukeAfricaSafariMac OS24
39Craig OkunevaAustraliaSafariAndroid64
40Terrell RunolfssonNorth AmericaFirefoxUbuntu95
41Zechariah PredovicSouth AmericaFirefoxMac OS31
42Isom GoodwinAntarcticaEdgeMac OS38
43Muhammad HarberAsiaOperaWindows79
44Henri StreichSouth AmericaSafariAndroid90
45Adriana SteuberEuropeFirefoxMac OS73
46Noe KrajcikAfricaFirefoxAndroid1
47Rupert NienowAsiaChromeMac OS49
48Angus SchoenAfricaOperaAndroid87
49Madisyn GrantSouth AmericaInternet ExplorerAndroid59
50Orlando LittelAustraliaOperaUbuntu2
51Jayson BeierSouth AmericaSafariWindows76
52Aurelie RunolfsdottirAfricaOperaiOS17
53Lupe TillmanAfricaOperaWindows11
54Cassandre MertzSouth AmericaEdgeMac OS98
55Norberto TreutelAfricaOperaMac OS21
56Faye BraunAsiaOperaAndroid66
57Emmie WolffSouth AmericaFirefoxAndroid55
58Karlee MorissetteNorth AmericaFirefoxiOS63
59Jamar PfannerstillAntarcticaEdgeUbuntu65
#NameContinentBrowserOSVisits
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>
            }
        ]
    }
/>
Copied!Cx Fiddle