xoel
November 10, 2023, 2:51pm
1
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.
ScottR
November 10, 2023, 2:53pm
2
What are you trying to achieve?
xoel
November 10, 2023, 3:08pm
3
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
grace
November 28, 2023, 7:31pm
4
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.