jQuery UI Widgets Forums Navigation Tree add nodes under a parent node

Tagged: , ,

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 12 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • add nodes under a parent node #11156

    dailyblog
    Participant

    hi,i learnt from DEMO that if i want to add node ,i should use method “addTo” . i have 2 questions .
    1. Method “selectedItem” is used in “settings.html”,but i could not find this method on API but “getselecteditem” method.
    2. if there is a parent node “A” ,not selected. how to add child node B to A in code since node A is not selected. i found if node A is selected and i could use “selecteditem” method to add a child node under A.

    $('#jqxTree').jqxTree('addTo', { label: 'Item' }, <strong>selectedItem.element</strong>, false);
    add nodes under a parent node #11170

    Dimitar
    Participant

    Hello dailyblog,

    You can add a subitem to an existing tree item even if it is not selected. Here is an example:

    var treeItems = $("#jqxTree").jqxTree('getItems');
    var firstItem = treeItems[0];
    var firstItemElement = firstItem.element;
    $('#jqxTree').jqxTree('addTo', { label: 'Item' }, firstItemElement);

    For more information, please check out the API.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    add nodes under a parent node #11174

    dailyblog
    Participant

    i have saved menu item to MySQL database, but i do not know how to add subitem dynamically.
    if i add a subitem to non-selected item , does the indexes of treeItems change?

    add nodes under a parent node #11176

    Dimitar
    Participant

    Hi dailyblog,

    The indexes will change if you set the treeItems variable again.

    var treeItems = $("#jqxTree").jqxTree('getItems');

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.