|
[app.component.ts]
this.commands = [
{ buttonOption: { iconCss: "vertical e-icons", cssClass: "e-flat" } }
];
this.childGrid = {
dataSource: orderDatas,
queryString: "EmployeeID",
allowPaging: true,
pageSettings: { pageSize: 6, pageCount: 5 },
columns: [
{
field: "OrderID",
headerText: "Order ID",
textAlign: "Right",
width: 120
},
{ field: "ShipCity", headerText: "Ship City", width: 120 },
{ field: "Freight", headerText: "Freight", width: 120 },
{ field: "ShipName", headerText: "Ship Name", width: 150 },
{ headerText: "Command button", width: 180, commands: this.commands }
]
}; |
|
[app.component.ts]
this.commands = [
{ buttonOption: { iconCss: "vertical e-icons", cssClass: "e-flat" } }
];
this.contextMenuItems = [
"Copy",
. . . .
];
this.childGrid = {
dataSource: orderDatas,
queryString: "EmployeeID",
allowPaging: true,
pageSettings: { pageSize: 6, pageCount: 5 },
contextMenuItems: this.contextMenuItems,
commandClick: function(args) {
(<any>this.contextMenuModule).element.ej2_instances[0].openMenu(
null,
null,
(<any>event).pageY,
(<any>event).pageX,
event
);
},
columns: [
{
field: "OrderID",
headerText: "Order ID",
textAlign: "Right",
width: 120
},
{ field: "ShipCity", headerText: "Ship City", width: 120 },
{ field: "Freight", headerText: "Freight", width: 120 },
{ field: "ShipName", headerText: "Ship Name", width: 150 },
{ headerText: "Command button", width: 180, commands: this.commands }
]
}; |
|
[app.component.ts]
commandClick: function(args) {
this.redirectToBacklog(); // Call your own function
var childGrid = args.target.closest(".e-grid").ej2_instances[0];
(<any>childGrid.contextMenuModule).element.ej2_instances[0].openMenu(
null,
null,
(<any>event).pageY,
(<any>event).pageX,
event
);
}.bind(this), |
|
[app.component.ts]
this.commands = [
{ buttonOption: { iconCss: "vertical e-icons", cssClass: "e-flat" } },
{ buttonOption: { content: "click me", cssClass: "e-flat" } }
];
this.childGrid = {
dataSource: orderDatas,
queryString: "EmployeeID",
allowPaging: true,
pageSettings: { pageSize: 6, pageCount: 5 },
contextMenuItems: this.contextMenuItems,
commandClick: function(args) {
if (
args.commandColumn.buttonOption.content &&
args.commandColumn.buttonOption.content == "click me"
) {
window.open("https://ej2.syncfusion.com/home/");
} else {
this.redirectToBacklog();
var childGrid = args.target.closest(".e-grid").ej2_instances[0];
(<any>childGrid.contextMenuModule).element.ej2_instances[0].openMenu(
null,
null,
(<any>event).pageY,
(<any>event).pageX,
event
);
}
}.bind(this),
columns: [
{
field: "OrderID",
headerText: "Order ID",
textAlign: "Right",
width: 120
},
{ field: "ShipCity", headerText: "Ship City", width: 120 },
{ field: "Freight", headerText: "Freight", width: 120 },
{ field: "ShipName", headerText: "Ship Name", width: 150 },
{ headerText: "Command button", width: 180, commands: this.commands }
]
};
} |