I am wondering how I might update the scheduler in the databinding event? When I try to call the dataSource read or just refresh the view, it goes into a continuous loop of datasource reading then scheduler databinding and nothing actually gets displayed in the scheduler.
My purpose for this is I am trying to filter events based on the start and end date of the current view because I am dealing with potentially thousands and thousands of events.
My databinding event for the scheduler is:
dataBinding: function(e){
console.log(e);
console.log(e.sender.view());
console.log(e.sender.view().startDate());
console.log(e.sender.view().endDate());
console.log(e.sender.dataSource.data());
if(e.action === 'rebind'){
console.log('Rebinding data to scheduler!');
Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.CalendarData.getCurrentViewEvents}', e.sender.view().startDate(), e.sender.view().endDate(), '{!fieldSetMap}', function(result, event){
result = result.replace(/\"\;/g, '"');
result = result.replace(/\#39\;/g, '\'');
var resultArray = JSON.parse(result);
console.log(resultArray);
var correctedResults = getNewEvents(resultArray);
console.log(correctedResults);
eventData = correctedResults;
//e.sender.dataSource.data(eventData);
//scheduler.view(scheduler.view().name);
});
}
},
It gets tricky trying to update and refresh the eventData (which needs to go to the dataSource read operation because that is all my events) dealing with the remote action, which happens asynchronously, thus it would be ideal to refresh inside the remote action method callback in the dataBinding event function. But yeah, doing so as I have tried just gives me the never-ending loop of dataBinding/reading.
I am grabbing events from a database then storing them locally in eventData, I know there are remote data examples of server filtering based on the start and end date of the current view, but those do not help in my situation with local data.