We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Error when grouping or Exporting to PDF when having a column with custom DateTime Format

Thread ID:

Created:

Updated:

Platform:

Replies:

144581 May 13,2019 12:12 PM UTC May 15,2019 05:39 AM UTC Angular - EJ 2 3
loading
Tags: Grid
Isaias Chalvatzoglou
Asked On May 13, 2019 12:12 PM UTC

Good Afternoon.

I have a problem when i am dragging a date time column to the group drop area when the column having custom format.
Also I have problem when i am trying to export to a pdf file when i have a date time column with custom format.

It raises error: TypeError: value.getDate is not a function

<e-column field='OrderDate' headerText='OrderDate' type='date' width='120' [format]='formatOptions' [enableGroupByFormat]='true'></e-column>

this.formatOptions = { type: 'dateTime', skeleton: 'short' };
or 
this.formatOptions = { type: 'dateTime', format: 'dd/MM/yyyy hh:mm:ss a' };


Thank you.








Attachment: Project_c1758233.7z

Pavithra Subramaniyam [Syncfusion]
Replied On May 14, 2019 09:04 AM UTC

Hi Isaias, 
 
Thanks for contacting Syncfusion support. 
 
We suspect that you are binding date column value as string type but grid expects value as date object which might be the cause of the reported behavior. So we suggest you to parse the grid data with DataUtil.parse.parseJson method.  . 
 
[component.ts] 
import {  DataUtil} from '@syncfusion/ej2-data'; 
 
@Component({ 
    selector: 'app-root', 
    templateUrl: 'a<ejs-grid #grid [dataSource]='data' allowPaging='true' [pageSettings]='pageSettings' [toolbar]='toolbar' (toolbarClick)='toolbarClick($event)' [allowExcelExport]='true' [allowPdfExport]='true' [allowGrouping]="true"> 
        <e-columns> 
           <e-column field='OrderDate' headerText='OrderDate' type='date' width='120' [format]='formatOptions' [enableGroupByFormat]='true'></e-column> 
            .  .  . 
        </e-columns> 
 
}) 
export class AppComponent { 
    public ngOnInit(): void { 
        this.data = DataUtil.parse.parseJson([{ 
      "OrderID":10307, 
      "OrderDate":"1996-09-17T00:00:00.000Z", 
      .   .  . 
   }]); 
this.formatOptions = { type: 'dateTime', skeleton: 'short' }; 
        .  .  . 
    } 
 
Please get back to us if you need any further assistance on this. 
 
Regards, 
Pavithra S. 
 


Isaias Chalvatzoglou
Replied On May 14, 2019 10:20 AM UTC

Hi Pavithra,

Now when I am dragging the date time column I have not problem anymore with grouping.

But the problem with grid exporting when date time column is grouped still remains.

ERROR Error: Uncaught (in promise): TypeError: value.getDate is not a function
TypeError: value.getDate is not a function
    at date-formatter.js:93
    at ExportValueFormatter.push../node_modules/@syncfusion/ej2-angular-grids/node_modules/@syncfusion/ej2-grids/src/grid/actions/export-helper.js.ExportValueFormatter.returnFormattedValue (export-helper.js:257)
    at ExportValueFormatter.push../node_modules/@syncfusion/ej2-angular-grids/node_modules/@syncfusion/ej2-grids/src/grid/actions/export-helper.js.ExportValueFormatter.formatCellValue (export-helper.js:306)
    at PdfExport.push../node_modules/@syncfusion/ej2-angular-grids/node_modules/@syncfusion/ej2-grids/src/grid/actions/pdf-export.js.PdfExport.processGroupedRecords (pdf-export.js:294)
    at PdfExport.push../node_modules/@syncfusion/ej2-angular-grids/node_modules/@syncfusion/ej2-grids/src/grid/actions/pdf-export.js.PdfExport.processGridExport (pdf-export.js:199)
    at pdf-export.js:128
    at new ZoneAwarePromise (zone.js:910)
    at PdfExport.push../node_modules/@syncfusion/ej2-angular-grids/node_modules/@syncfusion/ej2-grids/src/grid/actions/pdf-export.js.PdfExport.processExport (pdf-export.js:127)
    at pdf-export.js:111
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:391)
    at resolvePromise (zone.js:831)
    at resolvePromise (zone.js:788)
    at zone.js:892
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:423)
    at Object.onInvokeTask (core.js:16147)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:422)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (zone.js:195)
    at drainMicroTaskQueue (zone.js:601)
    at push../node_modules/zone.js/dist/zone.js.ZoneTask.invokeTask (zone.js:502)
    at ZoneTask.invoke (zone.js:487)

Thank you for your quick response!

Pavithra Subramaniyam [Syncfusion]
Replied On May 15, 2019 05:39 AM UTC

Hi Isaias, 

We have logged “Script error occurs while exporting the grouped Grid with enableGroupByFormat feature” as a defect and the fix for this issue will be available in our upcoming patch release on May 22nd, 2019. Until then We appreciate your patience. 

Regards, 
Pavithra S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon