jQuery UI Widgets Forums Navigation Tree Replacing the icon of an item

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

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Replacing the icon of an item #29242

    parascus
    Participant

    Hi jQWidget-Team,

    I’m populating a tree via json as the nodes are opened like it is shown in your demo. Also I have an icon on each item. On specific circumstances I’d like to change the icon using javascript and I tried it with: $(‘#myTree’).jqxTree(‘updateItem’, item, {icon: icon});
    This adds an icon to the existing item but the previous icon still remains. Is there any way to replace the existing icon or to remove the icon and afterwards inserting the new?

    The possibility to remove the item and add a new is not realy preferable because sometimes I would have to exchange big parts of the tree which would result in large amount to transfer data and to render.

    Do you have hint for me how I can solve this problem?

    Thanks in advance and best regards

    Stephan

    Replacing the icon of an item #29279

    Dimitar
    Participant

    Hello Stephan,

    Thank you for your feedback. We will look into the reported issue.

    Here is a workaround for the time being:

    $("#changeIcon").click(function () {
    var items = $('#jqxTree').jqxTree('getItems');
    var firstItem = items[0];
    $('#jqxTree').jqxTree('updateItem', firstItem, { icon: "../../images/recycle.png", label: firstItem.label });
    });

    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.