jQWidgets Forums
jQuery UI Widgets › Forums › Navigation › Tree › Default Tree Selection
Tagged: angular tree, bootstrap tree, javascript tree, jquery tree, jqwidgets tree, jqxtree, select inner
This topic contains 10 replies, has 2 voices, and was last updated by Hristo 9 years, 2 months ago.
-
AuthorDefault Tree Selection Posts
-
Hi,
I have a use case where i need to select the child only instead of selecting first tree element(which may be child or parent). Can you please help me how to check if this is a child and do selection.
From the below sample code i need to select child “Consumer photo and video” by default.
My Sample Code:
<div id=’jqxTree’>-
<li item-expanded=’true’>Solutions
- Education
- Consumer photo and video
- Mobile
- Rich Internet applications
- Technical communication
- Training and eLearning
- Web conferencing
- Financial services
- Government
- Manufacturing
- All industries and solutions
</div>
$(‘#jqxTree’).jqxTree({
height: ‘300px’,
width: ‘300px’,
theme: ‘energyblue’
});Hello Vinay Reddy,
Please take a look this example: http://jsfiddle.net/txhi/nqkp8aw9/1/
This code allow you to select only inner items.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comThanks for your help Hristo Hristov.
In the demo i see selection is done based on the id(“government”) which is known. In my case i have a client-server call where i dont know what is the id to be used to get selected.
All i need is to just select child item from the response what i receive from server through any mechanism.
Thanks
Hello Vinay Reddy,
Could you give to us more detailed information about received data from server.
Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comOk let me be more clear.
I will be loading a tree where data required for tree will be built at server and sent to client.
Now my requirement is to select first child of the tree by default. How can i achieve this.In the previous demo what you have suggested has static data and selection is done based upon the id (“government”) which is known child. But in my case the data from server will be dynamic.
Hello Vinay Reddy,
Please take a look this example: http://jsfiddle.net/txhi/esumjvqw/
Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comThanks this has worked.
But i need to check the currentItem.level == 1 or not, if my child is at level 2 then this does not work.
So can i know weather the current item is leaf/child or not. If i know the currentitem is child then i can select that item.Thanks
Hello Vinay Reddy,
Please take a look this example: http://jsfiddle.net/4ap8avm6/
Please uncomment inner list on ‘Education’Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comPerfect, this is to my expectation.
Thanks for the Help Hristo Hristov.I feel much helpful if this case is also addressed.
Above demo works fine only when complete tree is expanded, if we do not expand this is not to the expectation. Can you please do the selection of first child by expanding only first parent level instead of complete tree.Thanks for the response, this made my work little better.
Any update on this please
Hello Vinay Reddy,
Please take a look this example: http://jsfiddle.net/txhi/4ap8avm6/3/
Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.com - Education
-
AuthorPosts
You must be logged in to reply to this topic.