|
<template>
<div>
<button v-on:click="onBtnClick">Get current view dates</button>
<ejs-schedule ref="scheduleObj" id="Schedule" :height="height" :width="width" :actionComplete="onActionComplete">
<e-views>
<e-view option="Week"></e-view>
<e-view option="Month"></e-view>
<e-view option="TimelineMonth"></e-view>
</e-views>
</ejs-schedule>
</div>
</template>
<script>
import Vue from "vue";
import { SchedulePlugin, Week, Month, TimelineMonth, Resize, DragAndDrop } from "@syncfusion/ej2-vue-schedule";
Vue.use(SchedulePlugin);
export default {
data() {
return {
width: "auto",
height: "600px",
};
},
provide: {
schedule: [Week, Month, TimelineMonth, Resize, DragAndDrop],
},
methods: {
onBtnClick: function (args) {
// Printing the current view dates
console.log(this.$refs.scheduleObj.getCurrentViewDates());
},
onActionComplete: function (args) {
if (["dateNavigate", "viewNavigate"].indexOf(args.requestType) > -1) {
// Printing the current view dates once the current view dates rendered after the view or date navigation
console.log(this.$refs.scheduleObj.getCurrentViewDates());
}
},
},
};
</script> |
|
<template>
<div>
<button v-on:click="onBtnClick">Get current view dates</button>
<ejs-schedule ref="scheduleObj" :eventSettings='eventSettings'>
</ejs-schedule>
</div>
</template>
<script>
import Vue from "vue";
import { DataManager, UrlAdaptor } from '@syncfusion/ej2-data';
import { SchedulePlugin, Week, Month, TimelineMonth, Resize, DragAndDrop } from "@syncfusion/ej2-vue-schedule";
Vue.use(SchedulePlugin);
let dataManager = new DataManager({
url: 'http://localhost:54738/Home/LoadData',
adaptor: new UrlAdaptor(),
crossDomain: true
});
export default {
data() {
return {
width: "auto",
height: "600px",
eventSettings: { dataSource: dataManager }
};
},
};
</script> |
|
public class HomeController : Controller
{
ScheduleDataDataContext db = new ScheduleDataDataContext();
public ActionResult Index()
{
return View();
}
public JsonResult LoadData(Params param)
{
DateTime start = param.StartDate;
DateTime end = param.EndDate;
// Here filtering the events based on the start and end date value.
var data = db.ScheduleEventDatas.Where(app => (app.StartTime >= start && app.StartTime <= end)).ToList();
return Json(data, JsonRequestBehavior.AllowGet);
}
public class Params
{
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
}
} |