jQuery UI Widgets Forums Navigation Tree How to get the value in a check-tree

Tagged: , , ,

This topic contains 1 reply, has 2 voices, and was last updated by  Dimitar 11 years, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • How to get the value in a check-tree #20034

    antonomase
    Participant

    Hi,

    I have a jqxTree with checkboxes: true.
    and the list

    <ul>
    <li value="FR42">Alsace</li>
    <li value="FR61">Aquitaine</li>
    <li value="FR72">Auvergne</li>
    </ul>

    I use items = $(‘#jqxTree’).jqxTree(‘getCheckedItems’); to get the checked item

    The documentation describe the items fields :
    label – gets item’s label.
    value – gets the item’s value.

    When I try to read the labels (eg item[0].label) it is OK. I have Alsace or Aquitaine or Auvergne.
    But when I try to get the value, (eg item[0].value) it is always null.
    (confirmed when using microsoft javascript debugger)

    My question : how to set the value for items in a jqxTree ?

    Many thanks

    How to get the value in a check-tree #20052

    Dimitar
    Participant

    Hello antonomase,

    The value of a tree item may be set when the tree is initialized from a source and not from an HTML list. An example of such initialization is shown in the jqxTree Events demo. Having it in mind, here is how to modify the source to add a value to the first element:

    { icon: "../../images/mailIcon.png", label: "Mail", value: "Hello", expanded: true, items: [
    { icon: "../../images/calendarIcon.png", label: "Calendar" },
    { icon: "../../images/contactsIcon.png", label: "Contacts", selected: true }
    ]
    },

    Best Regards,
    Dimitar

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

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

You must be logged in to reply to this topic.