8 Answers, 1 is accepted
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.
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,
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.
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?
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
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
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