Introduction
There are two options for displaying a list of records - galleries and data tables. Their definitions per Microsoft Docs are:
- A gallery is a control that contains other controls and shows a set of data.
- A data table shows a set of data in a tabular format.
Which one should you use for your apps? The answer, for a change, is it depends. In the next section, I will list the advantages of both and when it makes sense to use one vs the other.
Tip - Pros & Cons of galleries
Pros:
- As the definition above states, it can have other controls inside
- It can be used to list, edit, and create new records
- You have the option to arrange data for each row horizontally (from left to right) or vertically (from top to bottom)
- There are 2 options - horizontal (with a horizontal scroll bar) and vertical (with a vertical scroll bar) galleries
- Flexible height galleries allow for row heights to adjust based on the row data
- A vertical gallery can have more than 1 column and a horizontal gallery can have more than 1 row. This can be achieved using the WrapCount property
- The default selected record can be specified using the Default property
- The default property helps in auto scrolling a gallery (detailed blog here)
- You can add a loading spinner just like how you can add one to a screen
Cons:
- There are no headers to designate what each control within a row is for. For this, you need to add labels/buttons outside the gallery
- For a vertical gallery, there is no horizontal scroll bar if the data cannot fit within the width of the screen
- There is no default text that gets displayed when there is no data within a gallery
Tip - Pros & Cons of data tables
Pros:
- It comes with headers that can be formatted without adding additional controls like buttons/labels
- The NoDataText property specifies what data to display when there is no data
- It provides a horizontal scroll bar if the data cannot fit within the width of the screen
- The AutoWidth property of a column allows for column widths to adjust based on the data
Cons:
- There is no horizontal data table
- You cannot add controls to a data table
- It cannot be used to edit or create new records
- There is no Default property to specify the default selected record
Thus, based on your use case, choose the one that makes the most sense. That being said, personally, I have always found galleries to be more versatile than tables! But, I don't want to bias you (am sorry if I already have!)
Stay tuned for the remaining 19 tips!
Recent articles
- A-Z: 26 tips! Learn how to improve your Power Apps!
- Add Picture vs Camera Control – Who is the winner?
- Background images for Power Apps screens – the right way!
- Combo box or Dropdown? - Who is the winner?
- Delegation in Power Apps – How to identify and test!
- Edit vs Display – Which is the better form?
- Formulas – How to learn the 170+ Power Apps formulas?
Since I’m starting to develop a schedule app at my job I find more useful how rich the galleries are, because we manage more than 10 schedules and having more than 10 DataTables inflicts a lot in the app performance.