Display month name in column header

1 Answer 147 Views
PivotGridV2
Kulwant
Top achievements
Rank 1
Iron
Kulwant asked on 06 Jan 2023, 04:34 PM

Hi I am using PivotGrid V2 and binding to local data ( json array ), the data contain a field called CompletedDate ( format 16/4/2022 18:00), what I would like to do is create a pivot grid that contain the month name columns as below, is this possible

Year: 2022
JanFebMarchAprilMayJune JulyAugSepOctDec
StatusReviewed141933452652233134
Awating Review3661111111123

4101134562762334151

 

Thanks

1 Answer, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 11 Jan 2023, 11:52 AM

Hi Kulwant,

I would suggest you use the columnHeaderTemplate option and display only the month of the corresponding date. Below is an example:

 <script id="columnTemplate" type="text/x-kendo-template"> 
     # if (member.levelName = 'CompletedDate CompletedDate' && member.levelNum == 1) { #
        # var date = new Date(member.caption) #
        # var month = date.toLocaleString('default', { month: 'long' }); #      
        <em> #: month #</em>
    # } else { #
        #: member.caption #
    # } #
</script>

Here you will find a Dojo example where the template from above is implemented.

I hope this helps.

Regards,
Neli
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PivotGridV2
Asked by
Kulwant
Top achievements
Rank 1
Iron
Answers by
Neli
Telerik team
Share this question
or