jQWidgets Forums

jQuery UI Widgets Forums React How can I put additional info in a tree?

This topic contains 2 replies, has 2 voices, and was last updated by  assembler 7 years, 5 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • How can I put additional info in a tree? #97678

    assembler
    Participant

    Hello everybody,

    I need to put some extra information in each tree node. That is to say: how can I tell the tree item if it is representing something without consulting the database or creating any additional structure?

    This is what I want to achieve:

    nodeBuilder = (x) => {
        return {
          id: x.idelement,
          label: x.description,
          value: x.elementkey,
          expanded: x.haschildren,
          parentid: x.parentid,
          myObj: {firstattr: '1st', myotherattr: 'other'}
        };
      };

    Here, I would like to put myObj in the tree item and then using it as this.myTree.getItem('item').myObj...

    Best regards

    How can I put additional info in a tree? #97713

    Ivo Zhulev
    Participant

    Hi, assembler,

    Unfortunately, this is not possible.

    Best Regards,
    Ivo

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

    How can I put additional info in a tree? #97733

    assembler
    Participant

    Hi, Mr. Ivo Zhulev,

    I think I found a way: I’ve tried myself and if I place an object into value instead a single value it works. Something like this:

    nodeBuilder = (x) => {
        return {
          id: x.idelement,
          label: x.description,
          value: {elementkey: x.elementkey, firstattr: '1st', myotherattr: 'other'},
          expanded: x.haschildren,
          parentid: x.parentid
        };
      };

    Anyway, thanks for your time.

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

You must be logged in to reply to this topic.