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

Set selected value client side

8 Answers 471 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Anuradha
Top achievements
Rank 1
Anuradha asked on 18 Jun 2014, 03:43 AM
Is there any client side api method that I can set selected value of RadDropDownTree? In API document I can't find a method. 

8 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Jun 2014, 05:42 AM
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.
0
Vijay kumar
Top achievements
Rank 1
answered on 29 Sep 2014, 10:23 AM
             
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,


0
Boyan Dimitrov
Telerik team
answered on 01 Oct 2014, 02:01 PM
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.

 
0
Damian
Top achievements
Rank 1
answered on 22 Jun 2015, 07:20 AM

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?

0
Nencho
Telerik team
answered on 23 Jun 2015, 01:20 PM
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
0
BesT LoLo
Top achievements
Rank 2
answered on 30 Jun 2015, 08:00 PM
Thanks Boyan, your solution is worked for my similar case
0
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
answered on 29 Feb 2016, 01:13 PM

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

0
Nencho
Telerik team
answered on 02 Mar 2016, 02:10 PM
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
Tags
DropDownTree
Asked by
Anuradha
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Vijay kumar
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Damian
Top achievements
Rank 1
Nencho
Telerik team
BesT LoLo
Top achievements
Rank 2
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or