Skip to content

Add fields to table element

DISCLAIMER: with the table collection element feature, I'm trying to follow the https://stacking.dev/ principles (Pointed out by @peter_baserow) to figure out what are the benefits and what are the drawbacks of such method in Baserow. As consequence, you'll see a lot of small MRs and may be sometimes it will break a bit the usual patterns we use in Baserow.

What is in this MR

This MR introduces the possibility to define fields to the table element. These fields have a Name and a Value formula. The value formula is used to say what do we want to display in each cells for this column in the table. Usually it will be a value of the current row but it can be a value from another data provider or even a formula based on the current row value.

To be able to select the right field from the current row, I've introduced a new CurrentRecordDataProviderType data provider. This data provider give access to the list of available fields for the selected data source for the current collection element and for the "current row". We also have the current index of the row, not really usefull for now but it might be later.

What will be in a next MR

  • Empty states are not handled yet (waiting inputs from Bram) so when the table has no field it only displays a line. Same when the dataSource is empty.
  • No fields are created by default
  • We can't select a field type
  • We can't configure the pagination (number of rows, pages, ...)
  • The data schema is not read from the backend yet

How to test this MR

  • Add a list source to a page
  • Add a table element
  • select the created list source
  • create new fields and set the name and the value
    • You should be able to select the properties of the current data source
  • They should appear in the table
  • You can order the fields
  • You can remove the fields

The initial design

image

Merge Request Checklist

  • changelog.md has been updated if required.
  • New/updated Premium/Enterprise features are separated correctly in the premium or enterprise folder
  • The latest Chrome and Firefox have been used to test any new frontend features
  • Documentation has been updated
  • Quality Standards are met
  • Performance: tables are still fast with 100k+ rows, 100+ field tables
  • The redoc API pages have been updated for any REST API changes
  • Our custom API docs are updated for changes to endpoints accessed via api tokens
  • The UI/UX has been updated following UI Style Guide

Closes #1836 (closed)

Edited by Jérémie Pardou

Merge request reports