@(Html.EJ().Grid<OrdersView>("Grid")
. . .
.Columns(col =>
{
col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(75).Add();
. . .
})
.ClientSideEvents(e=>e.ActionComplete("onActionComplete"))
)
<script type="text/javascript">
function onActionComplete(args) {
if (args.requestType == "save") {
this.model.dataSource.shift();// Remove the newly added record from first position
this.model.dataSource.push(args.data)// Push the newly added record in data source
this.refreshContent();
}
}
</script> |
I was able to get this to work following the first thread that I linked in the original post. The problem for me was that I had the Javascript function inside $(document).ready()
Thank you guys