I want to change select.options in editorBegin, but it is not reflected.
How should the optimal coding be?
colModel ("ID1" to "ID4")
colModel = [
{ title: "ID1", dataIndx: "id1", editable: false },
{ title: "NM1", dataIndx: "name1",
editor: {
type: "select",
labelIndx: "name",
valueIndx: "id",
prepend: { "": "-- select --" },
options: [],
mapIndices: { "id": id1, "name": name1 }
}
},
{ title: "ID2", dataIndx: "id2", editable: false },
{ title: "NM2", dataIndx: "name2" },
editor: {
type: "select",
labelIndx: "name",
valueIndx: "id",
prepend: { "": "-- select --" },
options: [],
mapIndices: { "id": id2, "name": name2 }
}
},
]
Grid Events.
editorBegin: function (evt, ui) {
this.showLoading();
var id = ui.dataIndx;
if (!id.match(/name[2-4]/)) { return };
var parentId = parseInt(id.replace(/name/g, "")) - 1,
val = ui.rowData["id" + parentId];
if (!val) { return };
var col = this.getColumn({ dataIndx: id });
$.getJSON("/api/names_select/" + val, function (dataJSON) {
col.editor.options = dataJSON.names;
})
// this.refreshCell({ dataIndx: id });
},