Hours scale missing from Scheduler

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
    });


Hi, I’m desperate to find a solution to this. Does anyone know?

Can you try to use version 3.0? It has updateCollection api which is designed to update list of units|sections|options on the fly, which can replace your custom updating logic.

docs.dhtmlx.com/doku.php?id=dhtm … collection

I had tried version 3 a week ago, but there were so many things stopped working I went back to 2.3. I just don’t have the time to upgrade to 3 right now.

Stanislav, are you saying there is no way to correct this without going to version 3.0?

but there were so many things stopped working I went back to 2.3
It is quite strange, because we have a lot of regression test, so all API, templates and config options must work the same ( if you have not made changes in source code directly - upgrade to version 3.0 must require only copying of new files )

We can’t able to reconstruct the same issue locally, so if you have any kind of sample or demo link - please share it.

Also, you can try to add the next command after changing collection and before setCurrentView call

scheduler.callEvent(“onOptionsLoad”,[]);