Right now it's rendering this weekly range - recurring correctly - for every row/resource but what I need is to render a diferent range for any of the rows.
I've tried adding this resourceId attribute, but notinhg has changed.
So you repeat modifications (that we did for time ranges store/model) to add recurrence support to resource time ranges feature data model:
// Make a new model extending default ResourceTimeRangeModel w/ RecurringTimeSpan mixin
class MyResourceTimeRange extends RecurringTimeSpan(ResourceTimeRangeModel) {};
// Make a new store extending default ResourceTimeRangeStore w/ RecurringTimeSpansMixin mixin
class MyResourceTimeRangeStore extends RecurringTimeSpansMixin(ResourceTimeRangeStore) {
static get defaultConfig() {
return {
modelClass : MyResourceTimeRange,
storeId : 'resourceTimeRanges'
};
}
construct(config) {
super.construct(config, true);
// setup recurrence support
this.setupRecurringTimeSpans();
}
};
// instantiate new improved store class
const resourceTimeRangesStore = new MyResourceTimeRangeStore();
Now you need Scheduler to track that store ..to populate occurrences of recurring records. This job is done by https://www.bryntum.com/docs/scheduler/#Scheduler/feature/RecurringTimeSpans feature. But you already use it to handle time ranges store and unfortunately RecurringTimeSpans yet supports tracking of a single store only (we have a ticket to improve that but it's not done yet).
As a workaround let's simply make a new feature for the Scheduler:
// Make a new feature to handle our new store
class MyRecurringTimeSpans extends RecurringTimeSpans {
static get $name() {
return 'MyRecurringTimeSpans';
}
};
// let's register the feature so scheduler was aware of it
GridFeatureManager.registerFeature(MyRecurringTimeSpans, false, 'Scheduler');
And now we simply add missing features to the Scheduler:
features : {
...
myRecurringTimeSpans : {
store : resourceTimeRangesStore
},
resourceTimeRanges : {
store : resourceTimeRangesStore
}
},
So you repeat modifications (that we did for time ranges store/model) to add recurrence support to resource time ranges feature data model:
// Make a new model extending default ResourceTimeRangeModel w/ RecurringTimeSpan mixin
class MyResourceTimeRange extends RecurringTimeSpan(ResourceTimeRangeModel) {};
// Make a new store extending default ResourceTimeRangeStore w/ RecurringTimeSpansMixin mixin
class MyResourceTimeRangeStore extends RecurringTimeSpansMixin(ResourceTimeRangeStore) {
static get defaultConfig() {
return {
modelClass : MyResourceTimeRange,
storeId : 'resourceTimeRanges'
};
}
construct(config) {
super.construct(config, true);
// setup recurrence support
this.setupRecurringTimeSpans();
}
};
// instantiate new improved store class
const resourceTimeRangesStore = new MyResourceTimeRangeStore();
Now you need Scheduler to track that store ..to populate occurrences of recurring records. This job is done by https://www.bryntum.com/docs/scheduler/#Scheduler/feature/RecurringTimeSpans feature. But you already use it to handle time ranges store and unfortunately RecurringTimeSpans yet supports tracking of a single store only (we have a ticket to improve that but it's not done yet).
As a workaround let's simply make a new feature for the Scheduler:
// Make a new feature to handle our new store
class MyRecurringTimeSpans extends RecurringTimeSpans {
static get $name() {
return 'MyRecurringTimeSpans';
}
};
// let's register the feature so scheduler was aware of it
GridFeatureManager.registerFeature(MyRecurringTimeSpans, false, 'Scheduler');
And now we simply add missing features to the Scheduler:
features : {
...
myRecurringTimeSpans : {
store : resourceTimeRangesStore
},
resourceTimeRanges : {
store : resourceTimeRangesStore
}
},
Scheduler.feature.RecurringTimeSpans is no longer available. Where do we import it from?
I tried to rename it to RecurringTimeSpan (singular) but an error occurs in your demo:
RecurringResourcesTimespan.PNG (140.44 KiB) Viewed 2039 times
There were few quite major changes in version 4.0 and one of them was recurring events refactoring. We decided that stores should not keep occurrences. It's mentioned in 4.0 upgrade guide.
The feature class is no longer needed so it was removed.
Yet I've just checked and found out that resourceTimeRanges feature for some reason doesn't work with recurring ranges properly in 4.x.
I'll check what happens today and come back with results ASAP. Here is a ticket to track the problem: https://github.com/bryntum/support/issues/1907
Thank you for the feedback!
The issue is resolved now so tomorrow's nightly build will have the fixed code.
The up to date code will look like this:
// We want to use recurring time ranges (see first entry in resourceTimeRanges array above)
// so we make a special model extending standard ResourceTimeRangeModel
// with RecurringTimeSpan which adds recurrence support
class MyResourceTimeRange extends RecurringTimeSpan(ResourceTimeRangeModel) {};
// Define a new store extending standard ResourceTimeRangeStore
// with RecurringTimeSpansMixin mixin to add recurrence support to the store.
// This store will contain time ranges.
class MyResourceTimeRangeStore extends RecurringTimeSpansMixin(ResourceTimeRangeStore) {
static get defaultConfig() {
return {
// use our new MyResourceTimeRange model
modelClass : MyResourceTimeRange
};
}
};
// Instantiate store for resourceTimeRanges using our new classes
const resourceTimeRangeStore = new MyResourceTimeRangeStore();
const scheduler = new Scheduler({
...
features : {
resourceTimeRanges : true
},
// store for "resourceTimeRanges" feature
resourceTimeRangeStore,
...
I've actually added this code to examples/resourcetimeranges demo to demonstrate a recurring time range. So check it out in the nightly build.
Also FYI I've made a ticket to support recurring in that feature store & model out-of-the box: https://github.com/bryntum/support/issues/1919
When the ticket is done the code applying mixins to store and model classes won't be needed anymore. The classes will have them applied by default.
Thanks for the help. It worked.
Related to this feature...We're using it to be able to display each resource working days and hours. Some users might work on sundays, for example. I've seen the working time example but doesn't seem to fit our requirements for a specific resource calendar.
Are we in the right direction or is there other feature that could help us display the working time (or calendar) for each resource?