<div id="Grid"></div>
<script type="text/javascript">
$("#Grid").ejGrid({
dataSource: new ej.DataManager({ json: data1, adaptor: new dateAdaptor() }),
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: "OrderID", headerText: "Order ID", width: 75, textAlign: ej.TextAlign.Right },
{ field: "OrderDate", headerText: "Order Date", width: 80, format: "{0:MM-dd-yyyy}", textAlign: ej.TextAlign.Right },
],
actionBegin: function (args) {
if (args.requestType == "save") {
var myDate = args.data.OrderDate;
myDate = ej.format(new Date(myDate), "MM-dd-yyyy");
myDate1 = myDate.split("-");
var newDate = myDate1[1] + "," + myDate1[0] + "," + myDate1[2];
args.data.OrderDate = new Date(newDate).getTime();
}
}
});
</script> |