<script>
ej.data.DataUtil.serverTimezoneOffset = (2 * (new Date().getTimezoneOffset() / 60)); //Set the servertimezoneoffset
</script>
<ejs-grid id="Grid" allowPaging="true" toolbar="@(new List<string>() {"Add", "Edit", "Update", "Delete" })">
<e-grid-editSettings allowAdding="true" allowDeleting="true" allowEditing="true"></e-grid-editSettings>
<e-data-manager url="/Home/UrlDataSource" adaptor="UrlAdaptor" insertUrl="/Home/Insert" , updateUrl="/Home/Update" removeUrl="/Home/Remove"></e-data-manager>
<e-grid-columns>
<e-grid-column field="OrderID" headerText="Order ID" isPrimaryKey="true" textAlign="Right" width="100"></e-grid-column>
...
</e-grid-columns>
</ejs-grid> |
function actionBegin(args) {
if (args.requestType === 'save') {
var grid = (document.getElementsByClassName("e-grid")[0] as any).ej2_instances[0];
var cols = grid.columns;
for (var i = 0; i < cols.length; i++) {
if (cols[i].type == "date") {
var date = args.data[cols[i].field];
args.data[cols[i].field] = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMilliseconds()));
}
}
}
}
|