This is a migrated thread and some comments may be shown as answers.

Gant views

1 Answer 73 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Mariam
Top achievements
Rank 1
Iron
Iron
Veteran
Mariam asked on 19 Jan 2021, 06:56 AM
Hi,
In gantt chart, can I see Year slots in Week and Month views??

1 Answer, 1 is accepted

Sort by
0
Stoyan
Telerik team
answered on 20 Jan 2021, 12:25 PM

Hi, Mariam,
Thank you for your question.

If I understand you correctly, you are looking to display the year as a part of the date in the slots of the Gantt. This can be achieved by using headerTemplates when defining the Gantt's views. The 'week' view shows days and weeks in the headers. Therefore you can utilize the dayHeaderTemplate and the weekHeaderTemplate to customize the date's formats. Similarly, the 'month' view shows weeks and months in its headers. They can be customized by weekHeaderTemplate and monthHeaderTemplate.

The following snippet shows an example of how the above can be done in practice:

views: [
              "day",
              { 
                type: "week",
                selected: true,
                dayHeaderTemplate: "#=kendo.toString(start, 'd')#"
              },
              { 
                type:"month",
                weekHeaderTemplate: "#=kendo.toString(start, 'dd')# - #=kendo.toString(kendo.date.addDays(end, -1), 'dd')#",
                monthHeaderTemplate: "#=kendo.toString(start, 'MMMM, yyyy')#",
              }
            ]

 

If the advice above isn't helpful in your scenario, please don't hesitate to contact us.

Regards,
Stoyan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Gantt
Asked by
Mariam
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Stoyan
Telerik team
Share this question
or