Clemens,
Yes, it is possible (and easy) to add/remove decorators dynamically. I needed
to do exactly this.
The decorators for a band are stored in an array in the band. We just need a
function to add them:
Timeline._Band.prototype.addDecorator = function(decorator) {
this._decorators.push(decorator);
decorator.initialize(this,this._timeline);
decorator.paint();
}
Create a new decorator and add to the desired band:
var band = tl.getBand(1);
var theme = Timeline.ClassicTheme.create();
band.addDecorator(new Timeline.SpanHighlightDecorator({
id:"my_decorator_id",
startDate: decorator_start_date,
endDate: decorator_end_date,
startLabel:"Start",
endLabel:"End",
theme:theme
}));
Then your decorator should show up on your timeline.
Removing is easy too:
Timeline._Band.prototype.removeDecorator = function(index) {
this._decorators[index].remove();
this._decorators.splice(index,1);
}
--Mike
On Nov 9, 2010, at 9:05 AM, einsA wrote:
> Hello list,
>
> is it possible to change (add/remove) some decorators to the bands
> dynamically - during runtime?
> I initialize the timeline on page load once and then inject/remove new
> data via json. Therefore it would be great not only to add/remove
> events but decorators too. I've tried to add the decorators and then
> calling the paint() methods of the timeline and the bands, but the new
> decorators doesn't appear.
>
> I hope you understand my wish and anybody can help me.
>
> Gruß
> Clemens
--
You received this message because you are subscribed to the Google Groups
"SIMILE Widgets" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/simile-widgets?hl=en.