@(Html.EJ().Grid<object>("FlatGrid")
.Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.DataSource)
.InsertURL(Url.Action("Insert", "Grid"))
.UpdateURL(Url.Action("Update", "Grid"))
.RemoveURL(Url.Action("Delete", "Grid"))
.Adaptor(AdaptorType.RemoteSaveAdaptor)
)
.ClientSideEvents(eve => { eve.ActionBegin("actionBegin").EndEdit("endEdit").EndAdd("endAdd").ActionComplete("actionComplete"); })
-----------------------
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();
col.Field("OrderDate").HeaderText("Order Date").Format("{0:hh:mm tt}").Width(80).Add();
}))
<script type="text/javascript">
function actionBegin(args) {
if (args.requestType == "save") {
this._isEditChangesApplied = true;
}
}
function actionComplete(args) {
if (args.requestType === "add") {
//Initialize Time Picker
$("#DisplayTime").ejTimePicker({ timeFormat: "hh:mm tt" });
//Set Current Time
$("#DisplayTime").data("ejTimePicker").setCurrentTime();
} else if ((args.requestType === "beginedit" && args.model.editSettings.editMode === "dialogtemplate")) {
const selectedRecord = this.getSelectedRecords()[0];
//Initialize Time Picker
$("#DisplayTime").ejTimePicker({ timeFormat: "hh:mm tt", value: selectedRecord.DisplayTime, width: "100%" });
}
}
</script>
<script type="text/template" id="template">
<b>Order Details</b>
<table cellspacing="10">
<tr>
-------------------------------
<td style="text-align: right;">
OrderDate
</td>
<td style="text-align: left">
<input id="DisplayTime" name="OrderDate" />
</td>
</tr>
</table>
</script>
|
Hi Ajay,
We can reproduce the mentioned issue in our sample with the attached code example. We have confirmed the issue “Server side is not triggered while edit the timepicker value” is a defect and logged a defect report. The fix for this issue is estimated to be available on 2nd May, 2017 and it will be included in our Volume 2, Service Pack 1 2017 which has been scheduled to be rolled out at the end of May 2017.As a workaround we suggest you to enable the this._isEditChangesApplied in the actionBegin event of ejGrid with the condition of requestType as save.Find the code example:
@(Html.EJ().Grid<object>("FlatGrid").Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.DataSource).InsertURL(Url.Action("Insert", "Grid")).UpdateURL(Url.Action("Update", "Grid")).RemoveURL(Url.Action("Delete", "Grid")).Adaptor(AdaptorType.RemoteSaveAdaptor)).ClientSideEvents(eve => { eve.ActionBegin("actionBegin").EndEdit("endEdit").EndAdd("endAdd").ActionComplete("actionComplete"); })-----------------------.Columns(col =>{col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();col.Field("CustomerID").HeaderText("Customer ID").Width(80).Add();col.Field("OrderDate").HeaderText("Order Date").Format("{0:hh:mm tt}").Width(80).Add();}))<script type="text/javascript">function actionBegin(args) {if (args.requestType == "save") {this._isEditChangesApplied = true;}}function actionComplete(args) {if (args.requestType === "add") {//Initialize Time Picker$("#DisplayTime").ejTimePicker({ timeFormat: "hh:mm tt" });//Set Current Time$("#DisplayTime").data("ejTimePicker").setCurrentTime();} else if ((args.requestType === "beginedit" && args.model.editSettings.editMode === "dialogtemplate")) {const selectedRecord = this.getSelectedRecords()[0];//Initialize Time Picker$("#DisplayTime").ejTimePicker({ timeFormat: "hh:mm tt", value: selectedRecord.DisplayTime, width: "100%" });}}</script><script type="text/template" id="template"><b>Order Details</b><table cellspacing="10"><tr>-------------------------------<td style="text-align: right;">OrderDate</td><td style="text-align: left"><input id="DisplayTime" name="OrderDate" /></td></tr></table></script>Regards,Prasanna Kumar N.S.V