Help with cell editing using fnCreatedCell and mData
Help with cell editing using fnCreatedCell and mData
tvalentine
Posts: 3Questions: 0Answers: 0
[code]"fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
// Omitted; construct input control for the cell
},
"mData": function (source, type, val) {
if (type === "set") {
// Omitted; grab the value from input control and set source variable appropriately
return;
}
else if (type === "display") {
// Whatever gets returned here replaces the input control created in "fnCreatedCell"
// The input control is already updated by this point... don't want/need to do anything
// What should be returned here?
}
}[/code]
I'm using fnCreatedCell to construct an input control that when clicked displays a datetimepicker the user may edit the cell value with. Inside mData where type equals "set" I grab the new value from the control and set the "source"[columnIndex] variable so the internal value datatables has for the cell matches it's visual value. When the user picks a datetime using the datetimepicker it generates a callback to call fnUpdate with the new cell value so mData where type equals "set" gets called. works great. then mData gets called again but this time where type equals "display". this is where I'm unsure what to return... really i don't want the display to change at all because I've already setup the custom control in fnCreatedCell and the control is already updated. Am i going about this wrong?
// Omitted; construct input control for the cell
},
"mData": function (source, type, val) {
if (type === "set") {
// Omitted; grab the value from input control and set source variable appropriately
return;
}
else if (type === "display") {
// Whatever gets returned here replaces the input control created in "fnCreatedCell"
// The input control is already updated by this point... don't want/need to do anything
// What should be returned here?
}
}[/code]
I'm using fnCreatedCell to construct an input control that when clicked displays a datetimepicker the user may edit the cell value with. Inside mData where type equals "set" I grab the new value from the control and set the "source"[columnIndex] variable so the internal value datatables has for the cell matches it's visual value. When the user picks a datetime using the datetimepicker it generates a callback to call fnUpdate with the new cell value so mData where type equals "set" gets called. works great. then mData gets called again but this time where type equals "display". this is where I'm unsure what to return... really i don't want the display to change at all because I've already setup the custom control in fnCreatedCell and the control is already updated. Am i going about this wrong?
This discussion has been closed.
Replies