My calendar:
<ScheduleComponent height='650px' className={classes.calendar} ref={schedule => this.scheduleObj = schedule}
showHeaderBar = {true}
group={{ byDate: true, allowGroupEdit: true, resources: ['Owners'] }}
resourceHeaderTemplate= { this.resourceHeaderTemplate }
dateHeaderTemplate= { this.dateHeaderTemplate }
eventRendered={this.eventRendered}
actionComplete={this.actionComplete}
actionBegin={this.onActionBegin}
navigating = {this.onSwitchDate}
eventSettings={{ dataSource: eventsArray }} >
<ResourcesDirective>
<ResourceDirective field='resourceIds' title='Assignee' name='Owners' allowMultiple={true} dataSource={users} textField='name' idField='id' colorField='color'>
</ResourceDirective>
</ResourcesDirective>
<ViewsDirective>
<ViewDirective option='Week' eventTemplate={this.eventTemplate } />
</ViewsDirective>
<Inject services={[ Week ]} />
</ScheduleComponent>
I noticed that when
eventsArray updated, entire Calendar blink( re-ender )
I debug a little:
@syncfusion/ej2-react-base/src/component-base.js:
ComponentBase.prototype.componentWillReceiveProps = function (nextProps) {
if (!this.isAppendCalled) {
clearTimeout(this.cachedTimeOut);
this.isAppendCalled = true;
this.appendTo(ReactDOM.findDOMNode(this));
}
var dProps = extend({}, nextProps);
var keys = Object.keys(nextProps);
for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
var propkey = keys_1[_i];
if (this.props[propkey] === nextProps[propkey]) {
delete dProps[propkey];
}
Here changed props comparing by shallow links, so group settings object always in changed props.
after thet in
@syncfusion/ej2-schedule/src/schedule/base/schedule.js
Schedule.prototype.onGroupSettingsPropertyChanged = function (newProp, oldProp, state) {
for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
var prop = _a[_i];
if (prop === 'headerTooltipTemplate') {
this.headerTooltipTemplateFn = this.templateParser(newProp[prop]);
} else {
state.isLayout = true;
if (this.eventWindow) {
this.eventWindow.refresh();
}
}
}
};
state.isLayout = true; marked as changed and re-render layout.
https://stackblitz.com/edit/react-9ab3ep?file=index.js
what is a best practice to fix it in my case?