If specify DataColumn.button property, you can display a button on the right side of the data cell. Currently, you can specify through CellButton.POPUP or ACTION.
In "Country" column, button has been specified as CellButton.POPUP, and DataColumn.popupMenu has been set as "menu01" menu which has been registered in the grid in advance. You can set the display mode of the menu button through buttonVisibility, and determine whether to display it through buttonDisplayCallback finally. In the example, the button is only displayed in the even numbered rows in "Country" column.
And, you can also use DataColumn.popupMenuCallback to display different menus in each cell. In the example, it displays different menus in each even and odd numbered rows in "Original Amount" column.
(CURRENT since v 1.3.8)
var columns = [{
name: 'Amount',
button: "popup",
popupMenu: "menu01",
popupMenuCallback: function (index) {
if (index.rowIndex % 2) {
return 'menu01'
} else {
return 'menu02'
}
},
...
];
CellButton.ACTION button has been set in "Interest Rate" and "Currency" columns. Like the example above, you can specify the button display mode, and set whether to display the button through buttonDisplayCallback.
If click the button during run time, GridBase.onCellButtonClicked event will be fired.
grid.onCellButtonClicked = function (grid, index) {
alert(index.column.name());
};