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
0Jorge KingEuropeFirefoxAndroid90
1Lee StrackeAsiaChromeUbuntu57
2Winifred LangworthAntarcticaOperaUbuntu41
3Rosendo MannAfricaSafariUbuntu35
4Ava WaelchiAfricaFirefoxMac OS45
5Afton ReillyAntarcticaInternet ExploreriOS84
6Reese PadbergNorth AmericaChromeUbuntu28
7Tressie FramiSouth AmericaSafariUbuntu16
8Britney MosciskiAsiaOperaWindows8
9Emilio TurcotteNorth AmericaFirefoxiOS96
10Gerda SchowalterNorth AmericaFirefoxiOS2
11Grady OrnSouth AmericaOperaAndroid75
12Jerad ThielNorth AmericaFirefoxUbuntu6
13Clare StrackeSouth AmericaOperaMac OS51
14Jordon AuerAsiaFirefoxMac OS42
15Jaron PredovicAsiaInternet ExplorerUbuntu22
16Ahmed MoenNorth AmericaFirefoxAndroid84
17Aaron BednarAustraliaChromeWindows61
18Coy RatkeEuropeSafariMac OS14
19Vernice RaynorAsiaInternet ExploreriOS4
20Nathan CrooksAfricaSafariMac OS69
21Kayli SchneiderEuropeEdgeMac OS48
22Brielle RutherfordNorth AmericaSafariAndroid30
23Terrance LefflerAfricaEdgeMac OS59
24Lane MitchellEuropeSafariUbuntu21
25Rosalind DibbertAfricaOperaMac OS19
26River JerdeAfricaOperaUbuntu28
27Ronny RusselSouth AmericaSafariUbuntu94
28Coralie CristNorth AmericaSafariMac OS78
29Dejuan LittleSouth AmericaEdgeMac OS1
30Roberto DonnellyAfricaChromeMac OS35
31Penelope PriceAsiaFirefoxAndroid17
32Ila GrantAsiaFirefoxMac OS71
33Deangelo HowellAustraliaOperaiOS71
34Kenya StehrSouth AmericaEdgeUbuntu79
35Raul HilllAfricaOperaMac OS99
36Jadon LindgrenEuropeOperaUbuntu5
37Sandrine CarrollAfricaFirefoxAndroid18
38Deangelo JenkinsAustraliaSafariUbuntu20
39Meta WalkerAsiaOperaWindows57
40Jennings BartolettiNorth AmericaOperaAndroid34
41Elza LegrosEuropeEdgeAndroid44
42Shany KesslerAfricaSafariAndroid13
43Carole GusikowskiNorth AmericaOperaUbuntu86
44Karina RutherfordNorth AmericaChromeMac OS52
45Roselyn GulgowskiEuropeSafariUbuntu71
46Jamey LarkinSouth AmericaSafariMac OS36
47Maryam RohanAustraliaChromeAndroid80
48Blaise ColeEuropeChromeUbuntu3
49Jodie KihnNorth AmericaChromeiOS40
50Freida JacobsonAsiaOperaMac OS11
51Gladyce BauchAustraliaChromeiOS47
52Jett RolfsonNorth AmericaOperaAndroid3
53Hillard KrajcikNorth AmericaOperaMac OS47
54Maureen SwaniawskiEuropeSafariiOS42
55Tevin SimonisAustraliaInternet ExplorerMac OS27
56Nelson HahnNorth AmericaOperaUbuntu13
57Danielle KemmerAfricaOperaAndroid4
58Aglae TorphyAsiaOperaUbuntu51
59Arielle RosenbaumAsiaSafariiOS50
#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