react-big-scheduler icon indicating copy to clipboard operation
react-big-scheduler copied to clipboard

Slow data loading on the component

Open NBenzekri opened this issue 4 years ago • 4 comments

Hi,

The component is so slow to load data on the component, the data are geted in just 50 ms but the user has to wait more than 10 sec to see the data loaded on the component.

A first debugging I made shows that the Idle library take the big part of loading time.

Please let me know if this issue can be improved.

Thanks

NBenzekri avatar Jul 16 '20 10:07 NBenzekri

Hi,

Do do you maybe know how to show data from api on the scheduler?

nikolara avatar Oct 17 '20 09:10 nikolara

Hi,

You can try map your response data as in I did in the SchedulerDataEvents,

events = [];
xios.get("getdata/", {
            headers: {
                'Content-Type': 'application/json'
            }
        }).then(response => {
            // console.log(response.data)
            if (response.data.length !== 0)
                this.events = response.data.map(row => {
                    return {
                        id: row.id,
                        start: row.ta,
                        end: row.td,
                        resourceId: row.poste,
                        title: <span> # {row.id} {' : '} {row.name} {' - '}{row.vName+ ' (' + row.vType} {')  '}{dateFormat(row.ta, 'HH:mm')} {' -'}{dateFormat(row.td, 'HH:mm')}
                            <br />
                            {'From '}<b>{row.departure}</b> {' To '}<b>{row.destination} </b><br />
                            {'POSTE: '}<b>{row.poste}</b></span>,
                        resizable: false,
                        movable: false,
                        bgColor: this.setColorByStatus(row.status)
                    }

                }) 

...

render(){

                        this.schedulerData.setEvents(this.events);
...
                         <Scheduler schedulerData={this.schedulerData}
                                        prevClick={this.prevClick}
                                        nextClick={this.nextClick}
                                        onSelectDate={this.onSelectDate}
                                        onViewChange={this.onViewChange}
                                        nonAgendaCellHeaderTemplateResolver={this.nonAgendaCellHeaderTemplateResolver}
                                    />

}

NBenzekri avatar Oct 19 '20 10:10 NBenzekri

Hi @NBenzekri,

Thank you for your response.

nikolara avatar Oct 28 '20 09:10 nikolara

Hi, Your last response was very helpful. Do you know maybe if it's possible to add resources to the database with AddResourceFrom, to make post request?

nikolara avatar Nov 04 '20 17:11 nikolara