diff --git a/src/TimeGrid.js b/src/TimeGrid.js
index a0b2fdbda..8d3cdc688 100644
--- a/src/TimeGrid.js
+++ b/src/TimeGrid.js
@@ -49,6 +49,7 @@ export default class TimeGrid extends Component {
allDayAccessor: accessor.isRequired,
startAccessor: accessor.isRequired,
endAccessor: accessor.isRequired,
+ resourceIdAccessor: accessor.isRequired,
selected: PropTypes.object,
selectable: PropTypes.oneOf([true, false, 'ignoreEvents']),
@@ -177,9 +178,7 @@ export default class TimeGrid extends Component {
let gutterRef = ref => this._gutters[1] = ref && findDOMNode(ref);
- let eventsRendered = resources ?
- this.renderEventsWithResource(range, rangeEvents, this.props.now, resources) :
- this.renderEvents(range, rangeEvents, this.props.now);
+ let eventsRendered = this.renderEvents(range, rangeEvents, this.props.now, resources || [{}]);
return (
@@ -202,8 +201,8 @@ export default class TimeGrid extends Component {
);
}
- renderEventsWithResource(range, events, today, resources) {
- let { min, max, endAccessor, startAccessor, components } = this.props;
+ renderEvents(range, events, today, resources) {
+ let { min, max, endAccessor, startAccessor, resourceIdAccessor, components } = this.props;
return range.map((date, idx) => {
let daysEvents = events.filter(
@@ -215,7 +214,7 @@ export default class TimeGrid extends Component {
return resources.map((resource, id) => {
let eventsToDisplay = daysEvents.filter(
- event => event.resourceId === resource.id
+ event => get(event, resourceIdAccessor) === resource.id
)
return (
@@ -238,34 +237,6 @@ export default class TimeGrid extends Component {
})
}
- renderEvents(range, events, today, id){
- let { min, max, endAccessor, startAccessor, components } = this.props;
-
- return range.map((date, idx) => {
- let daysEvents = events.filter(
- event => dates.inRange(date,
- get(event, startAccessor),
- get(event, endAccessor), 'day') && event.resourceId === id
- )
-
- return (
-
- )
- })
- }
-
renderHeader(range, events, width, resources) {
let { messages, rtl, selectable, components, now } = this.props;
let { isOverflowing } = this.state || {};