cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
arnoldaad
Regular Visitor

Refresh Gallery in Screen Through A Button In Component

Hi. I am new to powerapps, and am still understanding the connection between component and screen. Read some websites and watched a couple of youtube videos to get better understanding, yet I am still stuck with my current problem.

 

So I and my team, we are building an application using powerapps. What we are trying to achieve is to let user refreshes the data in the gallery by clicking or selecting a refresh button. The button is in the component. And our table (data) coming from Dynamics 365.

 

Here is what the screen looks like,

arnoldaad_0-1599460028310.png

 

We would like to let the user refreshes the data in the gallery by clicking the refresh button. So far we have no luck. What we have already done is something like the following.

 

1. We created a component named SubheaderList that looks like below, with the customer property as displayed below.

arnoldaad_1-1599460138571.png

arnoldaad_2-1599460223147.png

 

2. In the IconRefresh (still in the component), we input the following to the OnSelect

arnoldaad_3-1599460368680.png

 

3. Then, we moved to the screens. In the corresponding screen, we selected the table that is used to display the data in the gallery, in the component properties (in the screen)

arnoldaad_4-1599461539057.png

 

When we played the screen, we got the following error : Only managed connections can be refreshed. We tried to move the button to the the screen directly (removed it from the component and insert the button directly to the screen). The new button OnSelect property, we input Refresh(TABLE). And it worked just fine. When user selects the button, the data is refreshed.

 

Please advise where did we go wrong with the component approach. Big thanks in advance.

 

Arnold-

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @arnoldaad :

After a night of thinking, I perfected this solution.Here is my test for your refrence:

In the compontent

1\Add a Custom Output property -Refresh

2\Set the button 's items property to

 

Set(var,!var) /*var is my custom variable in this component*/

 

 3\Set the Refresh property to

 

Refresh

 

 In the App

1\Add a Toggle control in any screen(I have tried that no matter which screen it is placed on, the function can be triggered successfully)

Default

 

ComponentName1.Refresh=ComponentName2.Refresh /*As long as the output of Refresh of one of the two components changes, the value will change*/

 

If you have more components, you need to reconsider the calculation logic.

OnChange

 

Refresh(YourDataSource1);
Refresh(YourDataSource2);

 

Refresh all data sources, so you only need a toggle

Visible

 

false /*Let this control unvisible*/

 

85.gif

 Best Regards,

Bof

View solution in original post

3 REPLIES 3
v-bofeng-msft
Community Support
Community Support

Hi @arnoldaad :

Firstly,let me explan why the Refresh function do not work in the Component.

The point is the scope of a component is limited to itself.In other word,it is not available to refresh your data source by component.I think this link will help you a lot:

Scope

Secondly,I have two alternatives:

Solution1:Create a button outside the component and set it's Items property to:

 

Refresh(TABLE)

 

Solution2:Use component's OutPut to influence external controls, and then use external controls to complete Refresh. (I do not recommend this method)

Please refer to the following link for the specific solution:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Question-PowerApps-Components-How-to-Refresh...

Best Regards,

Bof

Hi, @v-bofeng-msft ! Thanks for the answer. Will take a look at your link and try to get the best solution.

 

The reason why we are thinking to put the refresh in the component, because the refresh icon is displayed almost in every screen, as requested by our user. Therefore, we are thinking rather than putting the icon in the screen directly, why not we put the icon in the component.

 

Thanks again for your feedback. We will try to implement your suggestion and will let you know whatever the results are.

 

Regards,

Arnold

Hi @arnoldaad :

After a night of thinking, I perfected this solution.Here is my test for your refrence:

In the compontent

1\Add a Custom Output property -Refresh

2\Set the button 's items property to

 

Set(var,!var) /*var is my custom variable in this component*/

 

 3\Set the Refresh property to

 

Refresh

 

 In the App

1\Add a Toggle control in any screen(I have tried that no matter which screen it is placed on, the function can be triggered successfully)

Default

 

ComponentName1.Refresh=ComponentName2.Refresh /*As long as the output of Refresh of one of the two components changes, the value will change*/

 

If you have more components, you need to reconsider the calculation logic.

OnChange

 

Refresh(YourDataSource1);
Refresh(YourDataSource2);

 

Refresh all data sources, so you only need a toggle

Visible

 

false /*Let this control unvisible*/

 

85.gif

 Best Regards,

Bof

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (55,512)