Hi Brian,
Greetings from Syncfusion Support.
We have validated the your requirement at our end and we have prepared the below sample by making call of dataBound and navigating events to achieve the requirement. To achieve your requirement, we have to provide the dates for all resources(employees) like below,
DateTime[] nancy = new DateTime[] {
new DateTime(2019, 10, 8),
new DateTime(2019, 10, 9),
new DateTime(2019, 10, 10),
new DateTime(2019, 10, 11),
new DateTime(2019, 10, 12)
};
employees.Add(new ResourceDataSourceModel { text = "Nancy", id = 1, groupId = 1, color = "#df5286", dates = nancy }); |
Based on this date field, we have to filter the resources by comparing with rendered date which can be collected by making call of getCurrentViewDates method like below,
isResourceUpdated = true;
var schObj = document.querySelector('.e-schedule').ej2_instances[0];
var resources = [];
var renderedDates = schObj.getCurrentViewDates();
for (var i = 0; i < empData.length; i++) {
for (var j = 0; j < empData[i].dates.length; j++) {
for (var k = 0; k < renderedDates.length; k++) {
var date = new Date(Date.parse(empData[i].dates[j]))
if (date.getTime() === renderedDates[k].getTime()) {
resources.push(empData[i].id);
k = renderedDates.length;
j = empData[i].dates.length;
}
}
}
} |
Once filtered the resources, we need to update the resource’s data source like below,
let resourcePredicate;
for (var a = 0; a < resources.length; a++) {
var predicate = new ej.data.Predicate("id", "equal", resources[a]);
resourcePredicate = resourcePredicate ? resourcePredicate.or(predicate) : predicate;
}
let resourceQuery = resourcePredicate ? new ej.data.Query().where(resourcePredicate) : new ej.data.Query();
schObj.resources[0].query = resourceQuery; |
Kindly try the above sample and revert us for further assistance.
Regards,
Vengatesh