@Html.EJS().Schedule("schedule").Width("100%").Height("650px").Views(view =>
{
view.Option(View.Day).Add(); view.Option(View.Week).Add();
view.Option(View.Month).Add();
}).CurrentView(View.Week).SelectedDate(new DateTime(2018, 8, 1)).EventSettings(es=>es.DataSource(dataManager =>{dataManager.Json(ViewBag.dataSource.ToArray()).CrudUrl("/Home/UpdateData").Adaptor("RemoteSaveAdaptor");
})).EditorTemplate("#EventEditorTemplate").ShowQuickInfo(false).PopupOpen("onPopupOpen").ActionComplete("onActionComplete").Render();
<script>
function onActionComplete(args) {
if (args.requestType == "eventChanged") {
$.ajax({
type: "GET",
url: "/Home/LoadData",
dataType: "json",
success: function (data) {
var obj = document.getElementById('schedule').ej2_instances[0];
obj.eventSettings.dataSource = data; // set as datasource
}
})
}
}
</script> |
function onActionComplete(args) {
if (args.requestType == "eventChanged") { $.ajax({ type: "GET", url: "/Home/LoadData", dataType: "json", success: function (data) { var obj = document.getElementById('schedule').ej2_instances[0]; var dataManger = new ej.data.DataManager({ crudUrl: "/Home/UpdateData", adaptor: new ej.data.RemoteSaveAdaptor() }); dataManger.dataSource.json = data; obj.eventSettings = { dataSource: dataManger }; obj.dataBind(); } }); } } |