I have 3 checkbox columns with corresponding date column. So what I am trying to achieve is when user clicks on checkbox during inline-edit and hits enter, today's date will be sent set as the value for another cell in a specified column. How to achieve? I recieved prior direction from OLEG on doing this with on form-edit but I would like to do this during inline edit instead. I have both enabled but only checkmarks will be editable during inline edit. I have all other fields disabled but the checkboxes columns. Any ideas would be greatly appreciated.
UPDATE Okay so I solved with the below code. Thanks Oleg for the help.
Current Date Function:
var date = new Date(Date.now());
console.log(todayDate(date));
function todayDate(date){
return (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear();
}
Check Column Code:
{ name: "devc", index: "devc",width: 25, align: "right", formatter: "checkbox",
editable: true, edittype: "checkbox",editoptions: {value: "Yes:No",defaultValue: "No",
dataEvents: [{type: "change", fn: function (e) {var $this = $(e.target), columnName = "devdate", rowid, cellId;
if ($this.hasClass("FormElement")) {
// form editing
cellId = columnName;
} else if ($this.closest("td").hasClass("edit-cell")) {
// cell editing
return; // no other editing field exist - nothing to do
} else {
// inline editing
rowid = $this.closest("tr.jqgrow").attr("id");
cellId = rowid + "_" + columnName;
}
$("#" + $.jgrid.jqID(cellId)).val($this.is(":checked") ?
(todayDate(date)) : "");} }]}}