If displayOptions of grid displayOptions is not true, when you right click SMART datagrid inside, the grid will display popup menu specified by GridBase.setContextMenu or setDefaultContextMenu rather than context menu of the browser. And, if set popupMenu in the column, when click menu button of data cell, it will display the corresponding popup menu registered by GridBase.registerPopupMenu. In both cases, it will specify the menu with object array containing the properties below.
grid.setContextMenu([{
label: "Add Row",
callback: function () {
grdMain.insert();
grdMain.setFocus();
}
}, {
label: "Delete Rows",
callback: function () {
grdMain.deleteSelection();
}
}, {
label: "-" // menu separator
}, {
label: "Excel Export",
tag: 'excel'
}]);
Property | Explanation |
---|---|
'type' | Not specified or can be 'check', 'radio'. If it is 'check', 'checked' state will be changed whenever click menu item. If it is 'radio', when click menu item, 'checked' of other items with the same 'group' will become false and the clicked item will become true. Check mark will be displayed on the left side of the item which 'checked' is true. If it is 'radio', a small circle will be displayed. In addition, 'checked' state will be transferred to menu callback function together with other properties. |
'visible' | If it is false, this item will not be displayed in the menu. The default value is true. |
'enabled' | If it is false, you will not be able to run callback by clicking this item. The default value is true. |
'label' | Text being displayed in the item. If set as '-', it will become menu divider. |
'group' | If 'type' is 'radio', when click this menu item, 'checked' of other items with the same group value will become false, and 'checked' of this menu item will become true. |
'checked' | If 'type' is 'check', when click this menu item, this value will be toggled to true, false. |
'tag' | Specify and use a random value which can separate this menu item. |
'children' | Specify sub menu items as array. |
'callback' | Callback function which will be run when click this menu item. function (data) { if (data.tag == 'abc') {} } These menu item properties will be transferred with being contained in 'data'. |