【问题标题】:Angular-Gantt - possible to change day's header to 'M,T,W,Th ...' instead of date?Angular-Gantt - 可以将日期的标题更改为“M,T,W,Th ...”而不是日期?
【发布时间】:2015-02-10 18:05:01
【问题描述】:
我正在使用 Angular-Gantt.js 模块开发调度应用程序。
它工作正常 - > 除了我想自定义标题以显示“M,T,W,Th,F ...”为日视图中的列。目前它显示像这个演示版本-->
https://www.angular-gantt.com/demo/
从模块的文档中可以看出,在创建和显示标头后触发事件,而不是在创建标头时触发。然而,有一个关于如何编写插件的指南。我想知道是否有人解决了这个问题并能指出我正确的方向。
非常感谢,
拉维
【问题讨论】:
标签:
angularjs
gantt-chart
【解决方案1】:
是的,这是可能的。只需在 html 中的 gantt 指令上添加 headers-formats 选项,并将以下代码添加到您的 $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'
},
}
将 headersFormats 的 'day' 属性设置为 'ddd' 将使其日期显示为 'Mon'、'Tue'、'Wed' 等