scheduler section update

Hi, i’m trying to update the sections collection of my timeline,
but i only got success in inserting data.
When i try to remove, the GUI don’t update
And after try to pass a empty array to updateCollection method,
i can’t insert more itens too, the GUI don’t get updated again.

My insert method:

self.sections.push({key: "test", label: "test"});
scheduler.updateCollection("timeline_sections", self.sections);

My clean method:

self.sections = [];
scheduler.updateCollection("timeline_sections", self.sections);

I tried to pass null too.
I tried to call scheduler.updateView() too,
but won’t work.

I init my timeline with this code:

        name: "timeline",
        x_unit: "minute",
        x_date: "%H:%i",
        x_step: 30,
        x_size: 8,
        x_start: 16,
        y_unit: self.sections,
        y_property: "section_id",
        render: "bar"

I saw that exists a deleteSection method,
but it is only for tree render, not bar.

you should initialize timeline like

scheduler.createTimelineView({ ... y_unit: scheduler.serverList("timeline_sections", self.sections), ... });
Then you’ll be able to use .updateCollection.
One more thing:self.sections.push({key: "test", label: "test"}); scheduler.updateCollection("timeline_sections", self.sections);It may not work due to inner implementation of updateCollection method, you can’t update collection with the same object you’ve used to initialize it(in case of deleting you create a new empty array object, so it will work correctly). If you copy array before passing it to .updateCollection everything should work as expected:self.sections.push({key: "test", label: "test"}); scheduler.updateCollection("timeline_sections", self.sections.slice(0)); … rlist.html … ction.html

Thanks, i get it now!

I still can’t seem to get the GUI to update when deleting a section, even after making a copy of the array before passing into .updateCollection, is that an issue with .updateCollection or am I doing something wrong?

More likely you do smth wrong, but I can not be sure of it, because I do not know how you implement it.