This is a migrated thread and some comments may be shown as answers.

How does editor get value from custom editor

6 Answers 1007 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ed
Top achievements
Rank 1
Ed asked on 01 Mar 2016, 08:50 PM

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

Sort by
0
Ed
Top achievements
Rank 1
answered on 01 Mar 2016, 09:53 PM
nevermind. figured it out. I had the data-bind attribute in there, but not in the initial fragment added to the container. Once I put that fragment with the data-bind attribute in there, it worked.
0
Ed
Top achievements
Rank 1
answered on 01 Mar 2016, 11:02 PM

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?

0
Ed
Top achievements
Rank 1
answered on 02 Mar 2016, 12:24 AM
back again on the data-bind issue. When the editor is the dropDownList, I'll want the value to be "dataValueField - dataTextField". Currently, it's only coming in as the dataValueField (using data-bind="value:<column field>"). I'm not sure how to get the data in the grid from the dropDownList in the proper format.
0
Accepted
T. Tsonev
Telerik team
answered on 04 Mar 2016, 07:41 AM
Hi,

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
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Ed
Top achievements
Rank 1
answered on 04 Mar 2016, 09:15 PM

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

0
T. Tsonev
Telerik team
answered on 08 Mar 2016, 09:23 AM
Hello,

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
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Ed
Top achievements
Rank 1
Answers by
Ed
Top achievements
Rank 1
T. Tsonev
Telerik team
Share this question
or