var grid = new ej.grids.Grid({
dataSource: DataManager,
allowPaging: true,
pageSettings: {
pageSize: 20
},
allowResizing: true,
isResponsive: true,
allowSorting: true,
allowMultiSorting: true,
allowFiltering: true,
allowGrouping: true,
allowReordering: true,
groupSettings: {
columns: ['category']
},
editSettings: {
allowEditing: true,
allowAdding: true,
// allowDeleting: true,
// mode: 'Batch',
mode: 'Normal',
newRowPosition:'Top'
},
// cellSave: function() {
// console.log('cellSave');
// },
// actionBegin: "actionBegin",
toolbar: ['Add', 'Edit', 'Update', 'Cancel'],
columns: [
{ field: 'id', isPrimaryKey: true, headerText: 'ID', textAlign: 'Right', width: 50,
validationRules: { required: true, number: true }
},
{ field: 'category', width: 100, headerText: 'Category', type: 'number' },
{ field: 'pn', width: 100, headerText: 'PN', type: 'string' },
{ field: 'srp', headerText: 'SRP', textAlign: 'Right', width: 50, format: 'C' },
{ field: 'work_instruction', headerText: 'Work Instruction', textAlign: 'Right', width: 200, format: 'C' },
{ field: 'status', headerText: 'Release Status', textAlign: 'Right', width: 50, format: 'C' },
{ field: 'location', headerText: 'Location', textAlign: 'Right', width: 50, format: 'C' },
{ field: 'comments', headerText: 'Comments', textAlign: 'Right', width: 200, format: 'C' },
{ field: 'equipment', headerText: 'Equipment', textAlign: 'Right', width: 120, format: 'C' },
{ field: 'client_pn', headerText: 'Client PN', textAlign: 'Right', width: 120, format: 'C' },
{ field: 'ownership', headerText: 'Ownership', textAlign: 'Right', width: 120, format: 'C' },
{ field: 'need_date', headerText: 'Need Date', textAlign: 'Right', width: 120, format: 'C' },
{ field: 'wbs', headerText: 'WBS', textAlign: 'Right', width: 120, format: 'C' },
{ field: 'service_order', headerText: 'Service Order', textAlign: 'Right', width: 80, format: 'C' },
],
actionComplete: actionHandler,
// cellDeselected: function() {
// console.log("cellDeselected");
// },
actionFailure: (e) => {
var span = document.createElement('span');
grid.element.parentNode.insertBefore(span, grid.element);
span.style.color = "#FF0000";
span.innerHTML = "Server exception: 404 Not found";
},
actionSuccess: function(args) {
console.log("actionSuccess");
},
getBatchChanges: function(args) {
console.log("getBatchChanges");
console.log(args);
}
});