I am currently using the gantt, scheduler, and grid components and want to link with my REST APIs.
When linking the back-end with the above three components, are there any methods without using DataManager instance with those components?
The development environment uses React, JavaScript, and Hook.
|
<ScheduleComponent height="650px" ref={schedule => (this.scheduleObj = schedule)} currentView="Month" selectedDate={new Date(2020, 5, 10)} dataBound={this.onBound.bind(this)} actionBegin={this.onBegin.bind(this)} >
onBound(args) {
if (this.flag) {
axios.get('http://localhost:54738/Home/GetData').then(response => {
var schObj = document.querySelector('.e-schedule').ej2_instances[0];
schObj.eventSettings.dataSource = response.data;
});
this.flag = false;
}
}
onBegin(args) {
if (args.requestType === 'eventCreate') {
axios
.post('http://localhost:54738/Home/Insert', args.data[0])
.then(response => {
var schObj = document.querySelector('.e-schedule').ej2_instances[0];
schObj.eventSettings.dataSource = response.data;
});
} else if (args.requestType === 'eventChange') {
axios
.post('http://localhost:54738/Home/Update', args.data)
.then(response => {
var schObj = document.querySelector('.e-schedule').ej2_instances[0];
schObj.eventSettings.dataSource = response.data;
});
} else if (args.requestType === 'eventRemove') {
axios
.post('http://localhost:54738/Home/Delete', args.data[0])
.then(response => {
var schObj = document.querySelector('.e-schedule').ej2_instances[0];
schObj.eventSettings.dataSource = response.data;
});
}
} |
|
onBound(args) {
if (this.flag) {
axios.get('http://localhost:54738/Home/GetData').then((response) => {
var ganttObj = document.querySelector('.e-gantt').ej2_instances[0];
ganttObj.dataSource = response.data;
});
this.flag = false;
}
}
|