Use a datasource in 'editorData' of a KendoGrid column


#1

I’ve KendoGrid column that I want to make editable with values populated from a DataSource.

Here is my datasource:

ui module EnergyManagement {
    dataSource Facilities {
        "c3type": "Facility",
        "responseSelector": "objs",
        "c3arguments": {
            "spec": {
                "include":  "[id, name, geometry, hasGasMeters, hasElecMeters, hasSteamMeters, hasChilledWaterMeters, hasHotWaterMeters, orgs.name, constructionDate, buildingAgeAnswer, grossFloorArea, facilityType, buildingNameAnswer]",
                "limit":    25,
                "filter": "facilityType!='Room'"
            }
        }
    }
}

This is what I’m doing in the column:

            {
                "label": "{~EnergyManagement.ProjectsListView.facility~}",
                "field": "facility.name",
                "format": "titleize",
                "width": 150,
                "align": "left",
                "sortable": false,
                "editable": true,
                "editor": "select",
                "editorData": "EnergyManagement.Facilities",
                "editorValueField": "id",
                "link": "/energymgt/facility/{{facility.id}}"
            },

But then this is how the column looks like:

What’s the proper way to pick the values from the datasource?


#2

Hi @bachr,

I believe C3 data sources are not supported in editorData at this time. The expected value of editorData is an array of objects, e.g.:

            {
                "label": "{~EnergyManagement.ProjectsListView.facility~}",
                "field": "facility.name",
                "format": "titleize",
                "width": 150,
                "align": "left",
                "sortable": false,
                "editable": true,
                "editor": "select",
                "editorData": [
                  { "id": "A" },
                  { "id": "B" },
                  { "id": "C" }
                ],
                "editorValueField": "id",
                "link": "/energymgt/facility/{{facility.id}}"
            },