SMART datagrid v.1 > Classes > GridBase

Back  Forward

DataLudi.GridBase.setDefaultContextMenu  method

Specify the default menu which will be run as grid context menu. You can specify the menu name registered by registerPopupMenu or new menu information object. 

If specify setContextMenu as null, it will run the menu specified by this function. If do not set the menu including this menu, it will run browser context menu. You can dynamically change the menu which will be run within onContextMenuPopup event handler. 

function setDefaultContextMenu (menu: String|PopupMenu|Object): GridBase;
Returns
GridBase
Parameters
menu - String|PopupMenu|Object. Defaults to null.
Code -1
    var menu = [{
            label: "Add Row",
            callback: function () {
                grdMain.insert();
                grdMain.setFocus();
            }
        }, {
            label: "Delete Rows",
            callback: function () {
                grdMain.deleteSelection();
            }
        }, {
            label: "-" /* menu separator */
        }, {
            label: "Excel Export",
            tag: 'excel'
        }];
    grdMain.setDefaultContextMenu(menu);
See Also
setContextMenu
registerPopupMenu
onContextMenuPopup
onContextMenuClicked
Examples
Grid Context Menu