Yes, this is possible. You need to modify the row total calculation logic so that it only includes the selected events.
The Annual leave tutorial (https://code.daypilot.org/97780/php-annual-leave-scheduling-javascript-html5-frontend-mysql) calculates the row total from all events in a row:
onBeforeRowHeaderRender: function (args) {
args.row.columns[0].html = "";
var totalDuration = args.row.events.totalDuration();
if (totalDuration.days() > 0) {
args.row.columns[0].html = args.row.events.totalDuration().totalDays() + " days";
}
},
You'll need to calculate the total manually for events from the selected range:
onBeforeRowHeaderRender: function (args) {
args.row.columns[0].html = "";
var totalDuration = args.row.events.forRange("2020-04-01", "2021-04-01")
.map(function(e) { return e.duration(); })
.reduce(function(previous, current) { return new DayPilot.Duration(previous.ticks + current.ticks); }, DayPilot.Duration.seconds(0));
if (totalDuration.days() > 0) {
args.row.columns[0].html = totalDuration.totalDays() + " days";
}
},
You may want to further adjust the logic according to your needs.