Dhtmlx-scheduler with React

I am using scheduler as follows:

from a dropdown i select a name (whose events I have to show on the scheduler) and it shows correctly,

nextState.showData is an array of data.

window.scheduler.parse(nextState.showData, 'json')

but when I deselect the same name, then scheduler should update and show me no events, but it is not updating…

although, On deselct of the name

 nextState.showData=[]

Please help. I am using dhtmlx-scheduler alongwith React…

Hello @Sonal215

Looks like you have already found a solution:

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.

I suggest you to change the code in the next way:

componentDidUpdate(prevProps) {
    window.scheduler.clearAll();

    if(this.props.showData.length) {
        window.scheduler.parse(this.props.showData, 'json')
    }
}

Thanks a lot for the reply…