Add data dynamically to tree with contextmenu attached

edited July 2018 in Technical questions

Hello,

I have a tree view with data loaded from my server.

webix.ui({
    container:"...",
    id: "mytreemenu",
    view:"tree",
    scroll: "xy",
    url: "...",
    onContext:{}
});

I attached a contextmenu to this tree view :

webix.ui({
    view:"contextmenu",
    id:"mycontextmenu",
    on:{
          "onBeforeShow": function(){ ... },
           "onItemClick": function(id, e, node){ ... }
    }
});

$$("mycontextmenu").attachTo($$("mytreemenu"));

But now, i have a button for dynamically add item into my tree view (like this : )

$$("mytreemenu").add({id:520, value:"new item"});

My problem is that my new item doesn't have the contextmenu.
I tried to do a .refresh() on both (mytreemenu & mycontextmenu), i tried too to attach again the contextmenu to my tree view with attachTo().

Maybe, someone has a solution for me ?

Thank you very much,

Chloé

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion