function onEditorPreparing(e) {
//------< onEditorPreparing() >--------
//*event on edit, called for each cell
//e=editorelement
var dataField = e.dataField;
if (dataField != null) {
if (dataField.includes("col_")) {
//----< Setup Editor >----
//-< get: List Day of Month >-
var dtToday = new Date();
var dtMonth = dtToday.getMonth();
var date = new Date(dtToday.getFullYear(), dtMonth, 1);
var days = ["DayNr", "DayText"];
while (date.getMonth() === dtMonth) {
var sDateIso = date.toISOString().split('T')[0];
var sDateFormated = date.toLocaleString("de", { weekday: "short", day: "numeric", month: "short", year: "2-digit" });
days.push({ "DayNr": sDateIso, "DayText": sDateFormated });
date.setDate(date.getDate() + 1);
}
//-</ get: List Day of Month >-
//< set Control >
e.editorName = "dxSelectBox";
e.editorOptions.dropDownOptions = { height:
500, width:200 };
e.editorOptions.dataSource = days;
e.editorOptions.valueExpr = "DayNr";
e.editorOptions.displayExpr = "DayText";
//</ set Control >
//----</
Setup Editor >----
}
}
|