Set selected value client side

9 posts, 0 answers
  1. Anuradha
    Anuradha avatar
    1 posts
    Member since:
    Jun 2014

    Posted 17 Jun 2014 Link to this post

    Is there any client side api method that I can set selected value of RadDropDownTree? In API document I can't find a method. 
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 Jun 2014 in reply to Anuradha Link to this post

    Hi Anuradha,

    Please try the below JavaScript to select a node based on the value.

    JavaScript:
    function pageLoad() {
        var dropTree = $find("<%=rdropTreeDetails.ClientID%>");
        dropTree.get_embeddedTree()._findItemByValue("2").select();
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vijay kumar
    Vijay kumar avatar
    1 posts
    Member since:
    Jun 2014

    Posted 29 Sep 2014 in reply to Shinu Link to this post

                 
    Hi Shinu,
                                   
    I have tried the JavaScript to select a node based on the value.
                                   
    Instead of value I find node by text.

    No error but
    the DropDownTree is not showing the seleceted item.

                                   
    Below is my JavaScript:

      
    m_Department = $find("<%= ddlDepartmentTree.ClientID %>")

                   
     var DepartmentNode = m_Department.get_embeddedTree().findNodeByText(sDept);

                   
     DepartmentNode.select();

    Regards,


  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 01 Oct 2014 Link to this post

    Hello,

    Please try to initiate explicitly a mouse click on one of the span elements within the node DOM element. The following code snippet shows how you can achieve this:
    //JavaScript
    m_Department = $find("<%= ddlDepartmentTree.ClientID %>")              
    var DepartmentNode = m_Department.get_embeddedTree().findNodeByText(sDept);
    DepartmentNode.select();
    var nodeElement = DepartmentNode .get_element();
    $telerik.$(nodeElement).find("span.rtIn")[0].click();



    Regards,
    Boyan Dimitrov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  6. Damian
    Damian avatar
    1 posts
    Member since:
    Jul 2011

    Posted 22 Jun 2015 in reply to Boyan Dimitrov Link to this post

    Hi,

    I'm trying to do a similar thing, and I'm using the 2015.1.401.40 version.  Unfortunately I keep getting the javscript error "Object doesn't support property or method 'get_text'".  The top of the call stack being here (in the minimized code):

    _getFullPath:function(J){var K=J.get_text(),I=J.get_parent();<br>while(I!==null){if(I.get_parent()!==null){K=I.get_text()+this._fullPathDelimiter+K;<br>}I=I.get_parent();<br>}return K;

     The reason seems to be that it keeps calling get_parent until it's null but that finds the radtreeview and it doesn't have a get_text function on it.  I tried to get around this by calling _createEntry directly with a disconnected node but that doesn't work at all (though it doesn't give the error as it doesn't have a parent without a get_text function.

     Is there a better way to, client side, select a node and add it as an entry with the latest version?

  7. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 23 Jun 2015 Link to this post

    Hello Damian,

    You can try to open the DropDown of the control, before executing the jquery click logic. Use the following approach:
    $find("<%= DropDownTree1.ClientID %>").openDropDown()

    Regards,
    Nencho
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. BesT LoLo
    BesT LoLo avatar
    11 posts
    Member since:
    Dec 2013

    Posted 30 Jun 2015 in reply to Boyan Dimitrov Link to this post

    Thanks Boyan, your solution is worked for my similar case
  9. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 29 Feb in reply to Boyan Dimitrov Link to this post

    Hi Boyan,

     

    When running the "virtual" click in OnClientDropDownClosed="OnClientDropDownClosed1" that particular checked item is not marked as entry on the server side.

     

    What can be done about this?

     

    BR,

    Marc

  10. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 02 Mar Link to this post

    Hello Marc,

    I have tested locally the described problematic behavior, but it seems that the Entries collection, applied trough the demonstrated approach with the click are accessible at server side. In the attachment you can find the sample example that I had used for testing purposes. At the button click you will be able to observe the access of the Entries collection.

    Please give it a try at your end and let us know if the issue still persist.

    Regards,
    Nencho
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017