Freeze the first section of timeline view


#1

Hi,

Is there a way to freeze the first section of timeline view ?
(like excel sheet : others sections can be scrolled but the first section fixed at the top of the list)

Thanks,


#2

Hi @anassder,
there is no built-in way in the scheduler to “freeze” the first line. You can do it with your own code. The better way is to change the style of HTML elements of the “first line”:

.dhx_matrix_line” // for the timeline 
.dhx_matrix_scell” // for the grid

The code may look like this fragment:

function lineFixer(){
  var firstMatrixLine = document.querySelector(".dhx_matrix_line"); // timeline
  var firstTableLine = document.querySelector(".dhx_matrix_scell"); // grid
  firstMatrixLine.style.position = "fixed";
  firstMatrixLine.style.zIndex = 5000;
  firstMatrixLine.style.top = 102;
  firstTableLine.style.position = "fixed";
  firstTableLine.style.zIndex = 5000;
  firstTableLine.style.top = 102;
  firstTableLine.style.background = "white";
}

Note, the additional styles will be removed after onClick, onCellClick, onBeforeDrag, onDragEnd, onAfterLightbox, onAfterSchedulerResize, onViewChange events fire, so you will have to apply these styles back after these events. You can see the result in the sample:

http://snippet.dhtmlx.com/5/c51ac7e2e

One more thing, as it is a “custom” solution some difficulties could occur in different timeline configurations, and this solution may need some fixes.