table.getDisplayedData() returns data that is not being displayed on the table

Better shown than said:

That company_object column is never displayed. However, the table.getDisplayedData() returns it.

This is the new Table component.

The getDisplayedData() method does work on other tables, but not on this one. Any idea why? This seems like a bug.

What are you trying to achieve?

Export the data. I use pagination and want to export only the data from the current page. If I use the table.exportData function, the file downloaded contains lots of empty lines, which I don't want.

In the end I made a script like this to achieve what I wanted

utils.exportData((await jobsNewTableGroupedByCompany.getDisplayedData()).slice(jobsNewTableGroupedByCompany.pagination.currentPage * numberInputResultsPerPage.value, numberInputResultsPerPage.value) , (queryNameEditableText.value || 'jobs_theirstack') + '_grouped_by_company', 'csv')

In this cased I solved it using _.omit()to exclude the columns I didn't want

utils.exportData((await jobsNewTableGroupedByCompany.getDisplayedData()).slice(jobsNewTableGroupedByCompany.pagination.currentPage * numberInputResultsPerPage.value, numberInputResultsPerPage.value).map(x => _.omit(x, checkboxShowJobTitlesColumn.value ? ['company_object'] : ['company_object', 'job_titles', 'dates_posted', 'job_urls'])) , (queryNameEditableText.value || 'jobs_theirstack') + '_grouped_by_company', 'csv')

But it would be much much nicer if table.displayedData() actually only returned... displayed data :slight_smile:

company_object seems to not be displaying in the table due to it being an object. You would need to key into the object to get a value to display.