datatable onContext

I’m struggling to understand how to attach a contextMenu to my datatable. Given the below… Where do I add the class so that my “onContext” event is invoked when I right click. I’ve tried adding classes in lots of places with the name “ctx” … but I can’t seem to make anything work.

thanks,
dk-

    columns: [
        {id: "fp", editor: "text", header: "FuncProcess1"},
        {
            id: "dg1",
            header: "Data Group 1",
            css: "centre",
            width: 200

        },
        {
            id: "dg2",
            header: "Data Group 2",
            css: "centre",
            width: 200
        },
        
    ],
    data: [
        {id: 1, fp: "step1", dg1: "-", dg2: "E"},
        {id: 2, fp: "step2", dg1: "E", dg2: "-"}
    ],
    onContext:{
        "ctx":function(id, event, target){
            webix.message("Active area was right-clicked");
        }
    }

The context menu can be attached to a datatable as described here (via simple .attachTo( $$("t1"));).

As for onContext, check the snippet: http://webix.com/snippet/2f679225

But if you need to attach the context menu to an icon or something else, there’s another way: you can get the row ID via custom attribute (e.g. $context) and still you’ll be able to read it. Check the snippet:

http://webix.com/snippet/bae7b365