|
Index.js
var grid = new ej.grids.Grid({
dataSource: window.orderDataSource,
editSettings: {
allowEditing: true,
allowAdding: true,
allowDeleting: true,
mode: "Normal",
newRowPosition: "Top"
},
allowPaging: true,
toolbarClick: clickHandler,
pageSettings: { pageCount: 5 },
toolbar: [
"Add",
"Edit",
"Delete",
"Update",
"Cancel",
{ text: "Click", tooltipText: "Click", prefixIcon: "e-expand", id: "Click" }
],
actionBegin: actionBegin,
columns: [
{
field: "OrderID",
isPrimaryKey: true,
headerText: "Order ID",
textAlign: "Right",
validationRules: { required: true, number: true },
width: 140
},
{
field: "CustomerID",
headerText: "Customer ID",
validationRules: { required: true },
width: 140
},
{
field: "Freight",
headerText: "Freight",
textAlign: "Right",
editType: "numericedit",
width: 140,
format: "C2",
validationRules: { required: true }
},
{
field: "OrderDate",
headerText: "Order Date",
editType: "datetimepickeredit",
format: { type: "dateTime", format: "M/d/y hh:mm a" },
width: 160
},
{
field: "ShipCountry",
headerText: "Ship Country",
editType: "dropdownedit",
width: 150,
edit: { params: { popupHeight: "300px" } }
}
]
});
grid.appendTo("#Grid");
function clickHandler(args) {
if (args.item.id === "Click") {
alert("Cutom toolbar click...");
}
} |