When I modify the list of Unit view sections in JavaScript, the units change fine however if there are not enough Units to fill the view, the hours scale disappears.
That starts a chain reaction of js errors and the page needs to be reloaded with enough Units to fill or nothing works.
I’ve attached an image to illustrate. You can see on the left the Hours scale is missing. And on the right the number of sections don’t “fill” the page horizontally.
My code to add/remove sections from the unit view is something like this:
function toggleUnits() {
// on a button click
// loop through a bunch of checkboxes to see get the sections that should be displayed
// then update the sections
var s=[{key:1, label:"Section A"},{key:2, label:"Section B"}];
sections.splice(0,sections.length);
sections.push.apply(sections,s);
scheduler.setCurrentView(scheduler.getState().date, scheduler.getState().mode);
}
My initial UnitView setup looks like this:
scheduler.createUnitsView({
name: 'unit',
property: 'sid',
list: sections,
size: my_unit_size_variable,
step: 1,
skip_incorrect: true
});