StephenChou1017 / react-big-scheduler

A scheduler and resource planning component built for React and made for modern browsers (IE10+)
https://stephenchou1017.github.io/scheduler/#/
MIT License
759 stars 414 forks source link

error change day, month, year #202

Closed marcos-lancy closed 4 years ago

marcos-lancy commented 4 years ago

The data load, however when changing between day, month, year, no longer load data.

`constructor(props) { super(props); var arrRe = []

    let schedulerData = new SchedulerData('2020-6-12', ViewTypes.Week, false, false, {});

    schedulerData.localeMoment.locale('pt-br');
    schedulerData.setResources(arrRe);
    schedulerData.setEvents(arrRe);
    this.state = {
        viewModel: schedulerData,
    }
}
async componentDidMount() {
    const responseRecurso = await ApiService.get('funcionarios');
    var recursos = responseRecurso.data;

    const responseEventos = await ApiService.get('values');
    var eventos = responseEventos.data;

    let viewModel = this.state.viewModel;
    this.state.viewModel.setResources(recursos);
    this.state.viewModel.setEvents(eventos);

    this.setState({
        viewModel
    });
};

render() {
    const { viewModel } = this.state;
    return (
        <div>
            <div>
                <Scheduler schedulerData={viewModel}
                    prevClick={this.prevClick}
                    nextClick={this.nextClick}
                    onSelectDate={this.onSelectDate}
                    onViewChange={this.onViewChange}
                    eventItemClick={this.eventClicked}
                    viewEventClick={this.ops1}
                    viewEventText="Ops 1"
                    viewEvent2Text="Ops 2"
                    viewEvent2Click={this.ops2}
                    updateEventStart={this.updateEventStart}
                    updateEventEnd={this.updateEventEnd}
                    moveEvent={this.moveEvent}
                    newEvent={this.newEvent}
                />
            </div>
        </div>
    )
}`