search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

When switching between gantt and resources view the resource-column-width is not updated

Asked by Viktor Eriksson
4 years ago.

Have a checkbox where I can switch between gantt-view and resources-view.
Event names are usually longer than resources names and when I switch back to resources-view the resources-column stays the same width as the longes event-name.

Fiddle can be found here: http://jsfiddle.net/Yja42/1/

Answer posted by Dan Letecky [DayPilot]
4 years ago.

The row header width auto-fit feature works like this:

1. It will extend the width beyond the initial width if needed. It starts from rowHeaderWidth - the new width is never smaller.
2. It stores the updated value back to rowHeaderWidth property.

See also:
http://doc.daypilot.org/scheduler/row-header-width-auto-fit/

There might become more configurable in the future but at this moment the solution is to reset the width to a small value before calling .update():

// ...
$("#gantt").click(function(){
  if (dps.viewType == "Gantt"){
      dps.viewType = "Resources";
  } else {
       dps.viewType = "Gantt";   
  }
  dps.rowHeaderWidth = 20;
  dps.update();
});

See the updated jsfiddle:

http://jsfiddle.net/Yja42/3/

This question is more than 6 months old and has been closed. Please create a new question if you have anything to add.