jQuery UI Widgets Forums Navigation Tree Getting the selected tag

This topic contains 5 replies, has 4 voices, and was last updated by  Peter Stoev 12 years, 4 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Getting the selected tag #3823

    mesken
    Participant

    I know it is possible to get the item label selected on a tree. But my problem is that I want to get the tag in which the label is found. How can I do this ? In fact I want to get the value of the id attribute of the tag related to the selected Item.
    All I want is to have the tag, once I have it, I can use the attr property to get the id value

    Thanks

    Getting the selected tag #3833

    support
    Participant

    To get the ID of the tag, use the Item’s Id.

    var id = item.id

    For example:

    $('#jqxTree').bind('select', function (event) {
    var args = event.args;
    var item = $('#jqxTree').jqxTree('getItem', args.element);
    var id = item.id;
    });

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Getting the selected tag #3837

    mesken
    Participant

    OK thank you. But I have another case. I am adding element to the tree programatically with the the addTo function
    if (selectedItem != null) {
    var menuName=$("#category").val();
    $('#jqxTree').jqxTree('addTo', { label: menuName }, selectedItem.element);
    }

    Can I set the Id of the tag where the element is being added ? For instance like the code above, I just added menuName , I want to set the Id of the corresponding tag also (e.g id=’newMenu’) when the menu element is being added, is it possible

    Getting the selected tag #3869

    Peter Stoev
    Keymaster

    In jQWidgets 2.0, the addTo method does not allow dynamically setting of the new element’s ID. We’ll consider adding an ‘id’ option in the next version.

    Thanks for the feedback.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Getting the selected tag #4139

    flexcarver
    Member

    Shouldn’t the getItem Method be in the documentation? It only has the getItems in there, thanx!

    Getting the selected tag #4140

    Peter Stoev
    Keymaster

    Thanks! It should be in the documentation and we’ll update it as soon as possible.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.