Context Menu on Dataview

I am trying to get the contextmenu to work with a dataview. I followed all the instructions I can find, but it doesn’t work. Does not throw any errors, but just does nothing on rightclick.

Any ideas?

Hello @JeffBurr ,

Firstly, you should include the onContext property into the component’s construction:

webix.ui({
     view:"dataview",
     id:"dataview1",
     ...
     onContext:{} // the empty object
});

Secondly, you need to initialize ContextMenu within a separate webix.ui function:

webix.ui({
          id:'cmenu', 
          view:'contextmenu', 
          data:[...]
});

Thirdly, you should link ContextMenu to the necessary component with the help of either

  • the attachTo() function:
$$('cmenu').attachTo($$('dataview1'));

Information about it you can find here

Sample: https://snippet.webix.com/k3alhq8f

1 Like