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

3 posts, 0 answers
  1. Jonatan
    Jonatan avatar
    19 posts
    Member since:
    Feb 2014

    Posted 11 Oct 2018 Link to this post

    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. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1041 posts

    Posted 15 Oct 2018 Link to this post

    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.
  3. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1041 posts

    Posted 15 Oct 2018 Link to this post

    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.
Back to Top