Canvas Apps Controls Expressions

Reset – How to reset a Power Apps gallery?

Resetting controls in Power Apps
Resetting controls in Power Apps

Introduction

Reset is a function I use pretty often. It resets a control to its Default property value. To learn more, click here.

Tip - Reset a gallery

Resetting most controls is pretty straightforward. However, when it comes to galleries, it isn't as easy in one particular scenario. That is when you want no record in the gallery to be selected when the gallery is reset. Leaving the Default property blank should work right? But it doesn't.

There are many use cases where you may want the behavior as described above. One such example is when we have a gallery of accounts and another gallery of contacts, with the contacts gallery displaying contacts for the selected account. So when you reset the accounts gallery, you would expect nothing to show in the contacts gallery.

To have no record in a gallery selected, set the Default property of the gallery to {}. Then when you call the Reset function, it will work as expected. To illustrate this, here is a quick demo:

Resetting a gallery
Resetting a gallery

Stay tuned for the remaining 8 tips!

Recent articles

  1. A-Z: 26 tips! Learn how to improve your Power Apps!
  2. Add Picture vs Camera Control – Who is the winner?
  3. Background images for Power Apps screens – the right way!
  4. Combo box or Dropdown? - Who is the winner?
  5. Delegation in Power Apps – How to identify and test!
  6. Edit vs Display – Which is the better form?
  7. Formulas – How to learn the 170+ Power Apps formulas?
  8. Galleries vs Data Tables – How to pick between the two in Power Apps?
  9. Hyperlinks – How to launch web pages & apps in Power Apps!
  10. Icons – How to increase performance!
  11. Jump start – How to speed up Power Apps dev with components!
  12. Keyboard – How to control the keyboard type on mobile
  13. LastSubmit – How to fetch the last submitted record in Power Apps
  14. Media controls in Power Apps – How to improve user experience!
  15. New screens – How to speed up Power Apps dev using templates!
  16. OnStart – How to optimize app loading experience!
  17. Phone camera – How to switch cameras on Power Apps mobile!
  18. Quotes – Should you use single or double in Power Apps?

4 thoughts on “Reset – How to reset a Power Apps gallery?”

Leave a Reply