I am doing inline editing in my grid and one of the columns has a custom editor. The control for this column varies based on the entered values of some other columns (this column is disabled until other column values entered.) This all works great, but when I save the row, the value isn't retrieved. How is the value from a custom editor retrieved?
When I edit the row, the editor for this cell is really just a placeholder div. Once the prerequisite columns have their values entered, I insert additional HTML into this div and instantiate the appropriate control (datePicker, dropDownList, multiSelect, numericTextBox, text input)
The only hint as to how this works is in this demo, which states:
- The value of this field points to a JavaScript function which instantiates the column editor for the corresponding column cells
Thanks,
--Ed
6 Answers, 1 is accepted
Back again... I was able to figure out the data-bind issue, but now that I'm swapping out one kendo control for another, even though I'm doing a kendo.destroy() on the td in the grid, I still have remnants of prior controls. If I do an empty in the td then append the fragment with the data-bind, it loses the ability to get the value from the control.
Any recommendations?
The principle of operation of the edit forms is described in detail in the Editing Functionality help article.
In your case the editors are very dynamic and might benefit from setting the value manually in the edit event.
I hope this helps.
Regards,
T. Tsonev
Telerik
Manually binding to the currently edited model works - at least for the "changing edit widget type" issue.
When I swap widgets, do a kendo.destoy on that td, then re-insert the div with the data-bind="value:<field>", I manually bind like so:
var
grid = $(
"#grid"
).data(
"kendoGrid"
);
var
model = grid.editable.options.model;
kendo.bind($(
"#value-container"
), model);
Is this what you were referring to?
Thanks,
--Ed
Re-initializing the binding should work, as it will properly dispose of existing bindings.
Let me know if you encounter any problems with that.
Regards,
T. Tsonev
Telerik