cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Slider Behaviour

I have a slider inside a gallery that has default value coming from datasource. My problem is that if a user change the value of slider then filter a gallery through textinput search. The slider is fetching back the value from datasource, over writting the users inititiated value. How can i retain the slider value from the user?

2 REPLIES 2
Pstork1
Dual Super User
Dual Super User

I'm not sure there is an easy way to do that.  When you filter the gallery you are filtering the datasource and reloading the gallery.  Since the slider setting hasn't been saved its normal that it will be overwritten when you refresh the gallery.  About the only way you could achieve this would be to load your items into a local collection and load the gallery from there.  Then make sure the slider writes its setting back to the collection if it is changed.  Then search the collection, which has the setting saved to filter the gallery. Just make sure you save any changes made to the collection back to the datasource when you are saving the record.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
v-xida-msft
Community Support
Community Support

Hi @Anonymous ,

Based on the issue that you mentioned, I have made a test, and the issue is confirmed on my side.

 

Actually, when you typed a search text within the Text Search Box, the Gallery would be reset/refreshed, and retrieve data from your data source again, so the Slider control within your Gallery would also be reset to default value.

 

As an alternative solution, you could consider save the Slider value back to your data source when the user made a change to the Slider value. Then Slider control would retain the value made from the user, even though, filter the Gallery items based on the Text Search box.

 

I have made a test on my side, please take a try with the following workaround:

Set the OnChange property of the Slider control within your Gallery to following:

Patch(
          'YourDataSource',
           ThisItem,
           {
               NumberColumn: Slider1.Value
           }
)

Note: The Slider control references values from the NumberColumn in your data source.

 

More details about the Patch function, please check the following article:

Patch function

 

Best regards,

Community Support Team _ Kris Dai
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 Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,242)