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. Image for the cookie policy date

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

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

3 Replies

PS Pavithra Subramaniyam Syncfusion Team 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. 
 



IC Isaias Chalvatzoglou 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!


PS Pavithra Subramaniyam Syncfusion Team 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. 


Loader.
Live Chat Icon For mobile
Up arrow icon