jQuery UI Widgets Forums Navigation Tree Manipulate tree node's label

Tagged: , , ,

This topic contains 6 replies, has 3 voices, and was last updated by  Mhanna AbuTareef 11 years, 10 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Manipulate tree node's label #21993

    Mhanna AbuTareef
    Participant

    Hi,

    Is it possible to change the label of the tree items to look like this:

    Category1
    Item1 0
    ItemItem1 0
    Item1 0
    Category2
    Item 0
    ItemItem 0
    ItemItem 0

    That’s means each item of the table has two parts, where part 1 aligned to the left and part 2 aligned to right.

    Regards,

    Mhanna

    Manipulate tree node's label #21997

    Dimitar
    Participant

    Hello Mhanna,

    You can style the labels however you like as shown in the demo Default Functionality.

    Best Regards,
    Dimitar

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

    Manipulate tree node's label #22161

    Mhanna AbuTareef
    Participant

    Hi,

    In case i wanna use binding by data adapter, how could i style the labels?

    In this binding i may use the text field ( and later map to label field). but text field is a string.

    Regards,

    Mhanna

    Manipulate tree node's label #22184

    Mhanna AbuTareef
    Participant

    Hi,

    Is there a solution?

    Regards,

    Mhanna

    Manipulate tree node's label #22188

    Peter Stoev
    Keymaster

    Hi guys,

    After the Tree’s initialization, the Tree will be built from UL/LI tags again. This means that you can use the approach that Dimitar suggested you or you can use jQuery to select the appropriate HTML Tag and change its appearance. Another approach is to use the recently added updateItem method of jqxTree.

    Invoke the updateItem method.
    // @param element (li tag)
    $('#jqxTree').jqxTree('updateItem', element, {label: "New Label"});
    The following code updates the first item.
    var treeItems = $("#jqxTree").jqxTree('getItems');
    var firstItem = treeItems[0];
    $('#jqxTree').jqxTree('updateItem', firstItem, { label: 'Item' });

    Best Regards,
    Peter Stoev

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

    Manipulate tree node's label #22224

    Mhanna AbuTareef
    Participant

    Hi,

    I already noticed that the element is created by UL\LI tag. So, i tried to add style in the text field as follows:

    data: [
    “id”: “anyID”
    “parentid”: “any”
    “text”: ‘ some text
    ]

    It works, and i see the item in a paragraph.

    However, When i insert a style, as follows, the result is strange. you can try. why?

    data: [
    “id”: “anyID”
    “parentid”: “any”
    “text”: ‘ some text
    ]

    Manipulate tree node's label #22226

    Mhanna AbuTareef
    Participant

    Hi,

    I mean these examples:

    example 1:

    data: [
    {"id": "anyID"
    "parentid": "any"
    "text": ' <p><strong>some text </strong></p>'}
    ]

    example 2:

    data: [
    {"id": "anyID"
    "parentid": "any"
    "text": ' <span style:"color:red">some text </span>'}
    ]
Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.