Setting a Context Menu

There are several functions available on the One.TLV class and you can see a complete list in the JS documentation. Here we are going to outline how to add a cell context menu to the TLV.

The function to set a cell context menu is setContextMenus(contextCellType, contextMenuCfg). It takes in an array of config objects and sets the context menu for a given cell context type. Below are examples for each cell context type along with the result in the UI:

  • TLVContextMenuType.BUCKET: Buckets are specified using an object in which the keys are data measure names and their values are the array of menu items:

    tlv.setContextMenus(One.TLVContextMenuType.BUCKET, {
    DMA: [{
    xtype: 'menuitem'
    ,text: 'Test bucket item'
    ,handler: Ext.emptyFn
    ,scope: this
    }]
    });

    images/download/attachments/144835758/bucket-context-menu-version-1-modificationdate-1645049410000-api-v2.png

  • TLVContextMenuType.BUCKET_HEADER : Bucket headers are specified using an object in which the keys are bucket indexes and their values are the array of menu items:

    tlv.setContextMenus(One.TLVContextMenuType.BUCKET_HEADER, {
    0: [{
    xtype: 'menuitem'
    ,text: 'Test bucket header item'
    ,handler: Ext.emptyFn
    ,scope: this
    }]
    });

    images/download/attachments/144835758/bucket-header-context-menu-version-1-modificationdate-1645049419000-api-v2.png




  • TLVContextMenuType.DM_HEADER : Data measure headers are specified just like buckets: using an object in which the keys are data measure names and their values are the array of menu items:

    tlv.setContextMenus(One.TLVContextMenuType.DM_HEADER, {
    DMA: [{
    xtype: 'menuitem'
    ,text: 'Test DM header item'
    ,handler: Ext.emptyFn
    ,scope: this
    }]
    });

    images/download/attachments/144835758/dm-header-context-menu-version-1-modificationdate-1645049429000-api-v2.png