I really need your help to resolve it. It is very complicated.
I've created a custom editor for this column but have 2 issues:
1. The value of the dropdown is not saved when I click enter. (It does when the editor type is just "select" not custom)
2. Doesn't called when the selection changed.
3. I tried to add the same code in the "$grid.on( "change", ".slctTypeClass", function() {" but still not working
Here is the code:
var approvedByEditor = function (ui) {
//debugger;
var $cell = ui.$cell,
rowData = ui.rowData,
rowIndx = ui.rowIndx,
dataIndx = ui.dataIndx,
width = ui.column.width;
ui.cls = "slctTypeClass";
//ui.rowHeight = "100px";
//var dc = $.trim(rowData[dataIndx]);
var options = ['-- Select --', 'Training','Vacation','Medical Leave',
'Emg OT','Stat Holiday','Sick','Standby','Relief Regular',
'Floater Day','Bereavement'];
var str="";
for (var i = 0; i < options.length; i++) {
str += '<option value="' + i + '">' + options + '</option>';
}
alert("Row Type:" + rowData["type"]);
if (rowData["type"] === "Relief Regular") {
$('<span><select class="' + ui.cls + '" id="slctType" name="' +
dataIndx + '" >'+str+"</select> Approved By: </span>").appendTo($cell).val(rowData[dataIndx]);
}
else {
$('<select class="slctTypeClass" id="slctType" name="' +
dataIndx + '" >'+str+"</select>").appendTo($cell).val(rowData[dataIndx]);
}
}