$(function () { window.gridData = [ . . . . ] $("#Grid").ejGrid({ // the datasource "window.gridData" is referred from jsondata.min.js dataSource: window.gridData, allowPaging: true, editSettings: { allowEditing: true, allowAdding: true, allowDeleting: true }, toolbarSettings: { showToolbar: true, toolbarItems: [ej.Grid.ToolBarItems.Add, ej.Grid.ToolBarItems.Edit, ej.Grid.ToolBarItems.Delete, ej.Grid.ToolBarItems.Update, ej.Grid.ToolBarItems.Cancel] }, columns: [ { field: "EmployeeID", isPrimaryKey: true, headerText: 'Employee ID', textAlign: ej.TextAlign.Right, validationRules: { required: true, number: true }, width: 90 }, { field: "EmployeeName", headerText: 'Employee Name', validationRules: { required: true, minlength: 5 }, width: 90 }, { field: "Age", headerText: 'Age', textAlign: ej.TextAlign.Right, editType: ej.Grid.EditingType.Numeric, validationRules: { required: true, range: [10, 60] }, width: 80 }, { field: "Email", headerText: 'Email', validationRules: { required: true, email: true }, width: 150 } ] });
|