Skip to Content

SmartTable Excel Download Date format issue

I'm using sap.ui.comp.smarttable.SmartTable for displaying data in table. I was able to display Dates in Date format by using CustomData.

But when I'm downloading data in Excel, it is showing data in json date format

/Date(1451606400000)/

I was able to show date format by using the onBeforeExport event, by passing type as Edm.Date type. This way, I was able to display json date as Date in MM/dd/yyyy format. But my requirement is to show date as dd/MM/yyyy. I understand that I need to use inputFormat property, but I could not figureout how to pass the property as my required data. Can anyone please suggest on the format I need to use..

viewcode.png (94.3 kB)
controllercode.png (137.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Dec 25, 2018 at 03:43 PM

    change inputFormat to format to see if it helps

    Add comment
    10|10000 characters needed characters exceeded

    • I tried.. it is not throwing any error but it is still showing the date in MM/dd/yyyy format..

      Tried these two statements..

      mExcelSettings.workbook.columns[33].format= "dd/MM/yyyy";

      mExcelSettings.workbook.columns[33].format= "dd-MM-yyyy";

      Do you think the date formats I'm trying to use are wrong?

      Thanks,

      Bhavya

  • Dec 25, 2018 at 05:43 PM

    Hi Bhavya,

    In the custom data that you are using, try passing the type as well:

    ...."leadingProperty":"", "type":"date" }'/>

    in the custom data along with the other properties you are passing,

    BR,
    Mahesh

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Mahesh,

      Sorry for the delayed response..

      I'm receiving date in the 'date' type from backend. It is coming in json format something like /Date(1490918400000)/

      I have tried changing the settings similar to that of in the example but it is still not showing in correct format..

      aCols.push({

      label: 'DateString',

      type: 'date',

      property: 'SampleDateString',

      inputFormat: 'yyyymmdd',

      width: 25 });

      Thanks,

      Bhavyasri M

  • Aug 08 at 01:53 PM

    Hi,

    Did someone find a solution for this? I've also tried onBeforeExport event, but without any success.

    BR,

    Adrian

    Add comment
    10|10000 characters needed characters exceeded