jQWidgets Forums

jQuery UI Widgets Forums Navigation Tree How to get selected tree item properties

Tagged: , , ,

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author

  • kzl
    Member

    Hi,

    I’m usin jqwidgets2.8 tree and i’m trying to get tree items properties when i click to them. The source is created  in a loop and data from a data base.

    for(var i in data)
    {

    arrayTree.push({

    //”id” : “idTreeMenu”+data[i].ID,
    “menuId”: data[i].ID,
    “label” : data[i].NAME
    });

    }

    var source = arrayTree;

    ///////////////////////////////////////

    Then i want to get “menuId” property.  I use “select” event and “getItem” method. But i can get only label.  Here is a sample

    $(‘#idDivTree’).on(‘select’,function(event){

    var item = $(‘#idDivTree’).jqxTree(‘getSelectedItem’, args.element);
    //alert(item);
    });

     

    How can i get “menuId” ? Can you help me ? Thank you.


    Dimitar
    Participant

    Hello kzl,

    You cannot add custom tree item properties, but you can use the value property to store custom data. Thus, it should be:

    for(var i in data)
    {
    arrayTree.push({
    //”id” : “idTreeMenu”+data[i].ID,
    “value”: data[i].ID,
    “label” : data[i].NAME
    });
    }

    Best Regards,
    Dimitar

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


    kzl
    Member

    Hi Dimitar,
    Thank you for your help

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

You must be logged in to reply to this topic.