jQuery UI Widgets Forums Navigation Tree Custom data inside tree

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Custom data inside tree #46204

    fatnjazzy
    Participant

    I have a simple tree, and I want on select to get the value of the member someData.

    
    var source = [{
        label: "Mail",
        expanded: true,
        items: [
            {   label: "Calendar"   someData: "SomeFunc"// I want to access someData
            }
        ]},
    ];
    
    $('#tree').jqxTree({
        source: source,
        select : function (e){
           alert(e.someData);// not possible
        }
    });
    

    Just FYI, I am doing this in order to “connect” each tree item to a function.
    So each tree can invoke a different function.

    Thanks

    Custom data inside tree #47589

    navteca
    Participant

    Did you ever get an answer to this question?

    I am also interested in this, and something similar.

    I am have a function that tells me the number of items for each branch of the tree, I need to add that information next to the name of the tree (label), I though i could do that with the html attribute when I am creating the source of the tree, but it is not working.

    Ramon

    Custom data inside tree #47601

    Dimitar
    Participant

    Hello Ramon,

    Custom item fields (such as someData) are not supported. For your custom data, you may use the value field, i.e.:

    var source = [{
        label: "Mail",
        expanded: true,
        items: [
            {   label: "Calendar", value: "SomeFunc"
            }
        ]},
    ];

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.