Angular-Gantt - possible to change day's header to 'M,T,W,Th …' instead of date?

依然范特西╮ 提交于 2019-12-11 03:14:20

问题


I am working on a scheduling app using the Angular-Gantt.js module. It is working fine --> except I'd like to customize the header to display "M,T,W,Th,F ..." for the columns in the day viewscale. Currently it displays like this demo version -->

https://www.angular-gantt.com/demo/

From the documentation for the module, there are events triggered after the headers are created and displayed and not when the header is being created. There is however a guide on how to write a plugin. I am wondering if anyone has tackled this issue and could point me in right direction.

Many Thanks, Ravi


回答1:


Yes, it is possible. Just add the headers-formats option on the gantt directive in the html and add the following code to your $scope.option:

In the html:
<div gantt
     header-formats="options.headersFormats">
<div>

In the controller:
$scope.option: {

  //other options

  headersFormats: {
      'year': 'YYYY', 
      'quarter': '[Q]Q YYYY', 
      month: 'MMMM YYYY', 
      week: function(column) {
        return column.date.format('MMM D [-]') + column.endDate.format('[ ]MMM D');
      },
      day: 'ddd', 
      hour: 'H', 
      minute:'HH:mm'
    },
}

Setting the 'day' property of the headersFormats to 'ddd' will make it to display the dates as 'Mon', 'Tue', 'Wed' e.t.c.



来源:https://stackoverflow.com/questions/27436685/angular-gantt-possible-to-change-days-header-to-m-t-w-th-instead-of-dat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!