jQWidgets Forums

jQuery UI Widgets Forums Navigation Tree Default Tree Selection

This topic contains 10 replies, has 2 voices, and was last updated by  Hristo 9 years, 2 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • Default Tree Selection #79380

    Vinay Reddy
    Participant

    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’
    });

    Default Tree Selection #79391

    Hristo
    Participant

    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 Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Default Tree Selection #79393

    Vinay Reddy
    Participant

    Thanks 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

    Default Tree Selection #79394

    Hristo
    Participant

    Hello Vinay Reddy,

    Could you give to us more detailed information about received data from server.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Default Tree Selection #79437

    Vinay Reddy
    Participant

    Ok 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.

    Default Tree Selection #79454

    Hristo
    Participant

    Hello Vinay Reddy,

    Please take a look this example: http://jsfiddle.net/txhi/esumjvqw/

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Default Tree Selection #79455

    Vinay Reddy
    Participant

    Thanks 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

    Default Tree Selection #79499

    Hristo
    Participant

    Hello Vinay Reddy,

    Please take a look this example: http://jsfiddle.net/4ap8avm6/
    Please uncomment inner list on ‘Education’

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Default Tree Selection #79505

    Vinay Reddy
    Participant

    Perfect, 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.

    Default Tree Selection #79559

    Vinay Reddy
    Participant

    Any update on this please

    Default Tree Selection #79601

    Hristo
    Participant

    Hello Vinay Reddy,

    Please take a look this example: http://jsfiddle.net/txhi/4ap8avm6/3/

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.