Getting the data actually displayed in table component

Hi everyone,

I've been trying to access the data displayed in a table component, where the column (object key) names match the column titles in the table and the cell values have the same format as seen in the table.
I tried {{table.getDisplayedData()}} for this purpose, but as shown in the attached image, it returns data that is different from what is displayed in the table. My goal is to download the table into a excel or csv file and I want to ensure the file contains the data exactly the same as what is presented in the table.

I looked into a couple of previous discussion but didn't make much progress so far.
I tried utils.exportData(await table1.getDisplayedData()) mentioned in the table.getDisplayedData() returns data that is not being displayed on the table and thedisplayedData property mentioned in Table component’s .displayedData field does not reflect actual data

Does anyone know how to solve this? Thank you!

Hi Doris,

What happens when you use the built-in download button at the bottom right of the table?

Screenshot 2024-07-17 at 4.01.57 PM

I tried this with one of my tables and the outputted CSV was indeed using the mapped column labels and cell data (as opposed to the underlying field names/raw data used to populate the table).

Hi @dguzzo,

Thanks for your reply! I tried the table default download option but it doesn't solve the problem. :smiling_face_with_tear:
In the downloaded csv file, the column names indeed match to the table columns. However, the data format of created at is still different. And if I try to hide any columns, they still appear in the downloaded file.

1 Like

Hello @doris.l!

I think you can modify the download click event action to correct this behavior easily enough:

For the formatting, you should be able to adjust the mapped value to be in the proper format in the column settings like:

When using the download button for the CSV, I was able to get the properly displayed columns and their preferred values:

image

2 Likes

Hi @pyrrho,
Thank you so much. It worked perfectly!!!