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:
Stay tuned for the remaining 8 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?
- Galleries vs Data Tables – How to pick between the two in Power Apps?
- Hyperlinks – How to launch web pages & apps in Power Apps!
- Icons – How to increase performance!
- Jump start – How to speed up Power Apps dev with components!
- Keyboard – How to control the keyboard type on mobile
- LastSubmit – How to fetch the last submitted record in Power Apps
- Media controls in Power Apps – How to improve user experience!
- New screens – How to speed up Power Apps dev using templates!
- OnStart – How to optimize app loading experience!
- Phone camera – How to switch cameras on Power Apps mobile!
- Quotes – Should you use single or double in Power Apps?
4 thoughts on “Reset – How to reset a Power Apps gallery?”