Hello! Because there is no option “scroll” in timeline view, I try to create it (see function _changeUnitsView() in attached test case). And today I tested speed of work function createTimelineView() with
if (ns.jq.browser.mozilla && window.console && window.console.time) {
console.time("runtime of createTimelineView in " + counter + "th time");
}
scheduler.createTimelineView(timelineObj);
if (ns.jq.browser.mozilla && window.console && window.console.timeEnd) {
console.timeEnd("runtime of createTimelineView in " + counter++ + "th time");
}
in FF+firebug.
My results:
if a few times call function createTimelineView(), it will run slower and slower. approximately 1 time add 40 ms to work time.
So question is there another way to create scroll without run createTimelineView every time when need scroll or how fix this problem (createTimelineView run slower and slower. approximately 1 time add 40 ms to work time)
i upload test case to http://ifolder.ru/20322224.
To reproduce bug - download, unpack zip-archive, then run index.html. you will see in top of the page the buttons to scroll timeline view. click it several times, and you will notice that UI bgin to work slower and slower. or you can uncomment
// create delay ~800ms (1 click ~40ms)
/*
for (var i = 0; i < 5; i++) {
this.jq("#nextTimelineButton").click();
}
for (i = 0; i < 9; i++) {
this.jq("#prevTimelineButton").click();
}
for (i = 0; i < 6; i++) {
this.jq("#nextTimelineButton").click();
}
*/
in helper.js
If you’ll do it in Firefox with enabled firebug, you will see all what i mean (run time of createTimelineView will log in console)
“Scroll”, I mean drawing timeline for changing start time and end time within one day. Please, perform the actions described in the previous post, and you’re will understand what is scroll in my term.
You said - new set of units.
I said - new start time and new end time.
Thanks for answer! But in real project I use timelineview with component dhtmlxscheduler_treetimeline. So in left of page we have some tree, and other part of page is scheduler.
How can I change view depending on choosing tree branch?
Simple example - ifolder.ru/20339539. In top of the page there are two buttons “one group” or “group with subgroup”. Click to one of them simulate choosing tree branch, and you can see, view repainted.
All repainting could be done by modifying timeline options settings and then calling onOptionsLoad event.
I’ve checked your sample and I am not quite sure what you were trying to do (except repainting timeline of course).
Yes, in timeline and units view you can do the following:
scheduler.matrix[timelineNameMode].y_unit = new_y_unit;
scheduler.callEvent("onOptionsLoad", []);
Where y_unit is an original array of sections and new_y_unit – new array which should be displayed.
Note that if you are creating your timeline view the following way:
When you can directly modify sections array and then call onOptionsLoad.
Now for the tree timeline view things are a bit different:
You can use API to add or remove units (check Tree Timeline section).
or
you can directly modify
scheduler.matrix[timelineNameMode].y_unit_original
array. Note that in this case we are using y_unit_original array as it stores original tree hierarchy and y_unit is a flat representation of it (used for displaying).
Hello! It’s similar problem in work of createUnitsView function, so I decided to update this theme, not create another one:
I try to change “list” of unitsView without call createUnitsView:
If in your code you define newList variable as some new array then indeed something could go wrong. We need to modify existing array instead of replacing with newly declared.
For example you could do something like that:
var sect=[
{key:2, label:"Section B"},
{key:3, label:"Section C"}
];
scheduler._props["myUnitMode"]["options"].splice(0,scheduler._props["myUnitMode"]["options"].length);
scheduler._props["myUnitMode"]["options"].push.apply(scheduler._props["myUnitMode"]["options"],sect);
scheduler.callEvent("onOptionsLoad",[]);
This will replace the whole content of the scheduler._props[“myUnitMode”][“options”] with the sect’s content.
No, it doesn’t work. see ifolder.ru/20558468. please, click button “load 2 sections (without calling)” with enabled js debugger. how it must be work - click button “load 2 sections”.
I have looked into your sample and have managed to find the culprit. The problem was with the ‘size’ property. To fix it you need to edit your dhtmlxscheduler_units.js file (uncompressed version).
scheduler.attachEvent("onOptionsLoad",function(){
var order = scheduler._props[name].order = {};
for(var i=0; i<list.length;i++)
order[list[i].key]=i;
if(scheduler._props[name].size > list.length) // new line
size = scheduler._props[name].size = 0; // new line
if (scheduler._date)
scheduler.setCurrentView(scheduler._date, scheduler._mode);
});
Similar update will be included in the upcoming version.