|
[OrderDetails.cs]
order.Add(new OrdersDetails(code + 1, "ALFKI", i + 0, 2.3 * i, false, new DateTime(9998, 12, 31, 0, 0, 0), "Berlin", . . . , "Kirchgasse 6"));
|
|
@* Syncfusion Essential JS 2 Scripts *@
<script>
ej.data.DataUtil.serverTimezoneOffset = 1;
</script> |
|
[ts]
import { ..., DataUtil} from '@syncfusion/ej2-data';
...
@Component({
...
})
export class FetchDataComponent {
...
ngOnInit(): void {
DataUtil.serverTimezoneOffset = (2 * (new Date().getTimezoneOffset() / 60)); //Set the servertimezoneoffset
this.parentData = new DataManager({
...
});
...
}
}
|
|
[HomeController.cs]
public IActionResult Index()
{
ViewBag.dataSource = OrdersDetails.GetAllRecords().ToList();
return View();
}
public ActionResult Update([FromBody]CRUDModel<OrdersDetails> value)
{
...
return Json(value.value);
}
//insert the record
public ActionResult Insert([FromBody]CRUDModel<OrdersDetails> value)
{
...
return Json(value.value);
}
//Delete the record
public ActionResult Delete([FromBody]CRUDModel<OrdersDetails> crudmodel)
{
...
return Json(crudmodel);
}
[Index.cshtml]
<script type="text/javascript">
window.griddata = '@Html.Raw(Json.Encode(ViewBag.dataSource))';
</script>
[fetchdata.component.ts]
ngOnInit(): void {
this.value = (window as any).griddata;
this.toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];
this.parentData = new DataManager({
json: JSON.parse(this.value),
updateUrl: "/Home/Update",
insertUrl: "/Home/Insert",
removeUrl:"/Home/Delete",
adaptor: new RemoteSaveAdaptor
});
...
}
[fetchdata.componenet.html]
<ejs-grid #Grid id='Grid' [dataSource]='parentData' ...>
...
</ejs-grid> |