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

Any Examples on how to implement dropdowntree on Grid edit template Popup?

2 Answers 266 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Jonatan
Top achievements
Rank 1
Jonatan asked on 11 Oct 2018, 09:32 AM

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

Sort by
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.
0
Veselin Tsvetanov
Telerik team
answered on 15 Oct 2018, 08:57 AM
Hello Jonatan,

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.
Tags
DropDownTree
Asked by
Jonatan
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Share this question
or