cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mattw112IG
Impactful Individual
Impactful Individual

How to force a Gallery to refresh its cards

I have a gallery, I have an edit form

When I submit the edit form would like the gallery item to refresh it's card with latest data

Data currently gets loaded to a collection when powerapp starts

"Refresh()" doesn't seem to work.

How would I do this?

ClearCollect?

 

Thanks,

Terry

1 ACCEPTED SOLUTION

Accepted Solutions
v-yutliu-msft
Community Support
Community Support

Hi @Mattw112IG ,

Do you mean that your data is saved in a collection and the gallery display the data in the collection?

Do you want to refresh the gallery items when you update your data source?

The reason why you met the problem is that:

1)Refresh() function is used to refresh data source, not collection

2)If you update your data source, data in the collection will not be updated automatically, you need to recreate the collection with the latest data of your data source.

So here are two solutions for you choosing:


1)use the data source as the gallery's Items directly, not the collection

Then set the form submit button's OnSelect:

SubmitForm(Formname);Refresh(data source name)

 //refresh the data source after you submit data

 

2)still use the collection as the gallery's Items

set the form submit button's OnSelect:

 

SubmitForm(Formname);ClearCollect(collectionname,data sourcename)

 

//recreate collection after you update the data source.

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
WarrenBelz
Super User
Super User

HI @Mattw112IG ,

You need to refresh your data source

Refresh(YourDataSourceName)

This is assuming your gallery Items are directly from the list (not a collection)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

v-yutliu-msft
Community Support
Community Support

Hi @Mattw112IG ,

Do you mean that your data is saved in a collection and the gallery display the data in the collection?

Do you want to refresh the gallery items when you update your data source?

The reason why you met the problem is that:

1)Refresh() function is used to refresh data source, not collection

2)If you update your data source, data in the collection will not be updated automatically, you need to recreate the collection with the latest data of your data source.

So here are two solutions for you choosing:


1)use the data source as the gallery's Items directly, not the collection

Then set the form submit button's OnSelect:

SubmitForm(Formname);Refresh(data source name)

 //refresh the data source after you submit data

 

2)still use the collection as the gallery's Items

set the form submit button's OnSelect:

 

SubmitForm(Formname);ClearCollect(collectionname,data sourcename)

 

//recreate collection after you update the data source.

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,208)