Yes, the main idea is that you should call scheduler.clearAll(); each time before you parse new data set.
As I mentioned on stackoverflow, you can remove window.scheduler.parse([], 'json') in the if condition because this line does nothing and actually doesn’t make sense.