I am trying to implement a DropDownTree on a Grid Editing Popup.
1: I am unable to make the DefaultValue work. I am using an ID Like so: m.Field(p => p.treeID).DefaultValue(3)
2: Selecting another value in the tree does not seem to change the value in the related Grid Cell.
2 Answers, 1 is accepted
0
Veselin Tsvetanov
Telerik team
answered on 15 Oct 2018, 08:56 AM
Hi Jonatan,
Attached you will find a small MVC sample, based on the scenario described. You will notice that in order to properly populate the selected value for the DropDownTree editor, I had to retrieve it in the Gredi.Edit() event and set it manually on the DataBound() event of the DropDownTree:
var selectedItem;
function onEdit(e) {
selectedItem = e.model.EmployeeID;
}
function onDataBound(e) {
if (selectedItem) {
setTimeout(function () {
e.sender.value(selectedItem);
e.sender.trigger('change')
});
}
}
The above is needed because of the hierarchical structure of the editor DataSource, which will cause several calls to the remote to be initiated on its initial load.
Regards,
Veselin Tsvetanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.
Please excuse me for missing the sample from my previous reply. You will find it attached here.
Regards,
Veselin Tsvetanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers.Learn More.