cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jaredt17
Level: Powered On

Question: Gallery Item Template Fill on a button pressed in that Gallery Item

Hello powerusers!

I have a quick question about a gallery I am using in a current project. 

 

I am trying to find a way to make it so that the templateFill on a specific item in the gallery is updated when one of the buttons in that Gallery Item is pressed, and only for that item is the templateFill set. 

 

Here is the code I have currently in the button:

Set(ButtonPressed, true)

I know the above code creates a global variable which is why all templateFills are all being set. I need to be able to set the button as pressed for that individual item in the gallery. The template fill code is set as:

If(ButtonPressed, RGBA(244, 115, 33, 1), RGBA(0, 0, 0, 0 ))

What can I change in the above samples to create a button that updates that individual fill for that item? 

Thanks for the help in advance! 

2 REPLIES 2
Super User
Super User

Re: Question: Gallery Item Template Fill on a button pressed in that Gallery Item

@jaredt17 

You need to have an individual column in your gallery list that will allow you to alter its value and thus you can "trigger" off of that.

 

I've attached a sample app that you can take a look at.  In there you will see this concept demonstrated.

Key items to review in the app:

1) OnStart - contains a simple collection to act as the datasource in this app

2) Fill My List button - OnSelect - in here we create the collection for the gallery and add the column that will be used to indicate the "state" of the row.  We set it to false as a default.

3) Gallery - pretty basic.  Datasource is the collection from #2 above and two labels for the sample data and an icon.

Take a look at the TemplateFill property on the gallery.  You will see the logic for the colors.

4) The icon in the gallery template - OnSelect property - here we patch the column in the current record in the gallery to toggle the true/false condition.

 

I hope that it is clear and helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
jaredt17
Level: Powered On

Re: Question: Gallery Item Template Fill on a button pressed in that Gallery Item

I will check this out right away. If I can get it working I will mark it as a solution.

Thank you! 

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

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