This is a migrated thread and some comments may be shown as answers.

How to synchronize the time line to scroll?

3 Answers 116 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Igor
Top achievements
Rank 1
Igor asked on 05 Nov 2014, 10:14 PM
If I have one page Gant  and Scheduler (or Gant  and Gant ) . How can I synchronize the move  time lines to scroll?

<div id="example" ng-app="KendoDemos" combine-horizontal-scrolls="k-grid-content">      
    <div ng-controller="MyCtrl" >      
        <div kendo-grid class="k-grid-content" options="mainGridOptions"></div> 
    </div>     
          <div ng-controller="twoCtrl" >       
        <div kendo-grid class="k-grid-content" options="mainGridOptions"></div> 
    </div>
</div>

myApp.directive('combineHorizontalScrolls', [function(){
var scrollLeft = 0;
function combine(elements){
elements.on('scroll', function(e){
if(e.isTrigger){
  e.target.scrollLeft = scrollLeft;
}else {
scrollLeft = e.target.scrollLeft;
elements.each(function (element) {
if( !this.isSameNode(e.target) ){$(this).trigger('scroll');}
});
}
});
}

return {
restrict: 'A',
replace: false,
compile: function(element, attrs){        
combine(element.find('.'+attrs.combineHorizontalScrolls));
}
};    
}]);

That's because only works in the Grid, but does not work in the Gantt



3 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 07 Nov 2014, 04:43 PM
Hi Igor,

in general, that approach should work for the gantt too, since it uses the same class for its scrollable content. Can you present your implementation in a runnable sample in our dojo? We may be able to help further. 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Igor
Top achievements
Rank 1
answered on 10 Nov 2014, 09:09 AM
I am interested time lines to timelines scroll, but does not work with it.

if you look at the source code there Gantt, class="k-grid-content", but it does not work

http://dojo.telerik.com/aWeGI
0
Petyo
Telerik team
answered on 11 Nov 2014, 01:31 PM
Hello,

the gantt scroller is not yet instantiated by the time the directive is compiled. Linking the scrolls with timeout resolves the issue

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Gantt
Asked by
Igor
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Igor
Top achievements
Rank 1
Share this question
or