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
0Florencio RyanAsiaFirefoxiOS73
1Jarrett ThompsonAsiaFirefoxAndroid37
2Keyon WildermanAfricaFirefoxAndroid58
3Arthur OkunevaAsiaFirefoxMac OS59
4Willow BednarAsiaFirefoxUbuntu95
5Jerald KonopelskiNorth AmericaInternet ExplorerUbuntu69
6Nat BruenAntarcticaChromeAndroid41
7Grady HermistonAsiaOperaUbuntu8
8Daphne ThompsonSouth AmericaChromeUbuntu67
9Jane WizaAfricaChromeiOS79
10Leon RoobSouth AmericaFirefoxAndroid60
11Minerva ThompsonAsiaFirefoxAndroid47
12Meagan StrosinAustraliaFirefoxWindows13
13Tara VonNorth AmericaSafariAndroid12
14Sylvester RutherfordAsiaOperaUbuntu63
15Aileen PredovicAntarcticaInternet ExplorerAndroid78
16Jeffrey BrekkeAsiaFirefoxAndroid23
17Michale BergstromAustraliaEdgeUbuntu48
18Evan TrompNorth AmericaOperaMac OS55
19Omari JacobsAfricaFirefoxAndroid53
20Sarai FeestAustraliaSafariWindows94
21Chris MetzAustraliaSafariMac OS23
22Berniece DickinsonAsiaChromeAndroid20
23Sheila HarrisNorth AmericaOperaWindows35
24General AltenwerthAsiaFirefoxAndroid4
25Lilly KilbackAustraliaSafariMac OS18
26Guadalupe MohrAfricaChromeMac OS25
27Patience LarsonAustraliaInternet ExplorerMac OS15
28Terrance GreenfelderAustraliaInternet ExplorerUbuntu77
29Andres ErdmanEuropeOperaiOS25
30Kale HeidenreichSouth AmericaFirefoxMac OS42
31Emie SchroederEuropeOperaUbuntu51
32Bonnie HoppeSouth AmericaOperaMac OS37
33Abner HermistonSouth AmericaFirefoxUbuntu90
34Louisa KlockoAfricaFirefoxWindows41
35Alden GreenfelderAntarcticaFirefoxWindows51
36Kamryn NaderAfricaOperaAndroid68
37Kay HintzAntarcticaChromeWindows84
38Eveline HeathcoteAfricaSafariMac OS99
39Heaven AbshireAustraliaEdgeAndroid74
40Laurie NitzscheAfricaOperaMac OS69
41Kristian LindgrenAustraliaInternet ExplorerAndroid75
42Beryl GoodwinNorth AmericaOperaAndroid3
43Domingo LubowitzSouth AmericaEdgeUbuntu86
44Margie GerholdAfricaInternet ExplorerUbuntu44
45Granville ThompsonAfricaSafariUbuntu76
46Haskell SchinnerAntarcticaOperaUbuntu17
47Nils McClureAfricaSafariAndroid93
48Manley RueckerEuropeEdgeMac OS27
49Fernando BahringerAfricaChromeAndroid70
50Anastasia FlatleyNorth AmericaEdgeMac OS25
51Ernestina SwiftSouth AmericaInternet ExploreriOS88
52Mya McClureAntarcticaOperaUbuntu24
53Pierce GrantNorth AmericaFirefoxMac OS84
54Garrick WelchAfricaEdgeMac OS32
55Jayson GaylordEuropeEdgeMac OS51
56Jalen KemmerAsiaInternet ExplorerUbuntu32
57Frederic BashirianAustraliaFirefoxWindows86
58Jody McKenzieNorth AmericaChromeMac OS69
59Jedediah FerryAsiaEdgeUbuntu7
#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