Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created a webpart with a JS Grid control with gantt enabled. I want the gantt view to display months instead of weekdays. Anyone have an idea how to do this?

Update: The following link is what I used to create the gantt webpart. http://msdn.microsoft.com/en-us/library/ff407962.aspx What I need is to zoom out gantt.

I have found SetZoomLevelInternal and SetZoomLevel in JsGrid.Gantt.js but cant see how to get it working.

share|improve this question
    
Is this a third-party gantt control? If so, can you send a link to it for us to take a look at? –  John Chapman Apr 26 '12 at 21:42
    
    
Does anybody know how to change the width of each row in Gantt chart? –  Nitin Chhabra Jan 17 '13 at 22:44

1 Answer 1

Combining SharePoint 2010 – Autozoom Gantt Chart Web Part with my own code, i get this:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script><script type="text/javascript">
// By Cees Timmerman, 24oct12.
$(function(){
  setTimeout(function(){
    $("th[title='Title']").css({"width":"400px"})
    for (var i = 0; i < 3; ++i) WebPartWPQ2_JSGridController.ZoomOutGantt()
  }, 2000)
})</script>

Put that in a Content Editor's HTML source and enjoy.

If you want to get all fancy, try this:

ExecuteOrDelayUntilScriptLoaded(function(){
  var oldGanttControl = SP.GanttControl
  SP.GanttControl = function(){
    oldGanttControl.call(this)
    var oldInit = this.Init
    this.Init = function(jsGridControl, jsRawGridData, params){
      oldInit.call(this, jsGridControl, jsRawGridData, params)
      DoCustomizations(jsGridControl)
    }
  }
}, "SPGantt.js")
function DoCustomizations(grid){
  grid.SetSplitterPosition(800)
  grid.SetGanttZoomLevel(grid.GetGanttZoomLevel()-1)
  var columns = grid.GetColumns()
  $.each(columns, function(key, value){value.width=200})
  grid.UpdateColumns(grid.parentNode.jsgridtableviewparams.columns)
}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.