almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timeline - how to dynamically change options value?

christophepersoz opened this issue · comments

Hello,

I'm trying to find a way to dynamically change the end and max values of options but I can't figured it out. Is there a way to do that and change the available range for the timeline once created?

setWindow() only apply to the current max range, but I would like to extend that on my will.

Thanks!

Have you tried to apply your changed settings using the setOptions method?

Oh, no, I haven't. I didn't know that there was a setOptions method. Gonna try it! Thanks

Indeed, it does work. Thanks a lot @daRoof !
I have noticed that if I had to change the original code on the example editingItemsCallback.html to this below. Keeping the tests makes the items behaving in a weird way once the options end or max is updated.

onMoving: function (item, callback) {
      /*
      if (item.start < min) item.start = min;
      if (item.start > max) item.start = max;
      if (item.end   > max) item.end   = max;
      */  
      console.log( item.start );
      callback(item); // send back the (possibly) changed item
    },