web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Multiple Buttons Color...
Power Apps
Unanswered

Multiple Buttons Color/Fill Change Filter Gallery

(0) ShareShare
ReportReport
Posted on by

Hi All
I have One gallery (Gallery1), I have a date range that filters Gallery 1 and 3 buttons called (Assign to me, Unassigned, All) that also filters Gallery1. When the App starts up, the date range is showing everything (All) in the Gallery.  Since Gallery1 is showing everything at startup, I need to have button "All" show default blue fill w/white color but have the other buttons show a different fill (light gray) w/black color. Also, when you click on the other buttons, it changes the fill  back to a default blue w/white color and then it makes the other buttons fill (light gray) w/black color. Basically showing the filter view in Gallery1 as what button was selected. I hope this makes sense. Thank you

Categories:
I have the same question (0)
  • cha_cha Profile Picture
    4,932 Moderator on at

    Can you share some screenshots?

  • Community Power Platform Member Profile Picture
    on at

    Hi @cha_cha 
    Here are the screenshots:

    When the App opens up: It looks like this: The buttons are the same color and Gallery1 is showing everything from seeing the total count on the right side.

    Screenshot1.png

    I need to have the "All" button displaying lets say a blue fill w/white color like this below when the App opens up :

    Screenshot2.png

    Then lets say, when I click on "Assign to me", it will have a blue fill w/white color and showing the correct count on Gallery1 while the other two buttons are displaying like below.

    Screenshot3.png

    I hope this helps.

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    Sure...you will just need to set the Color and Fill properties.

     

    However...before jumping into that (because I believe you are using multiple variable to denote the selections - Assign to me, Unassigned, All), I would recommend that you reduce your app overhead by removing the three buttons and adding a gallery for your buttons instead.

     

    The Items property of your Gallery would be: ["Assign to me", "Unassigned", "All"]  

    You would have a button in the gallery and set the Text property to: ThisItem.Value

     

    THEN, the Color property of your Button would be: If(ThisItem.IsSelected, White, Black)

    And your Fill property would be: If(ThisItem.IsSelected, Blue, LightGray)

     

    This would take care of all the requirements you have in your post here.

    The only thing next would be to adjust your formula for Filtering based on the galleryForButtons.Selected.Value

     

    i.e. (and I am assuming this is the same app as your other posts...)

    Search(
     Filter(
     ccDataCollection,
     galleryForButtons.Selected.Value = "All" ||
     (galleryForButtons.Selected.Value = "Assigned to me" && <yourUserValue> in AssignedTo),
     Date >= DatePickerStart.SelectedDate,
     Date <= DatePickerEnd.SelectedDate
     ),
     txtSearchBox.Text, "Code", "Batch_No", "Owner", "LBox", "Contract_No", "AssignedTo"
    )​

     

    This would make your experience much simpler and would also make it much easier to maintain your app (without all the variables).

     

    I hope this is helpful for you.

  • cha_cha Profile Picture
    4,932 Moderator on at

    Hello @Anonymous , 

     

    Please follow @RandyHayes' advice as it is the appropriate approach when building your goal. It's simple and straightforward.

  • Community Power Platform Member Profile Picture
    on at

    Hi @RandyHayes 
    Okay, I did what you mentioned above: Created a new called galleryForButtons

    The Items property of your Gallery would be: ["Assign to me", "Unassigned", "All"]  

    You would have a button in the gallery and set the Text property to: ThisItem.Value

    THEN, the Color property of your Button would be: If(ThisItem.IsSelected, White, Black)

    And your Fill property would be: If(ThisItem.IsSelected, Blue, LightGray)

    --------------------------
    So, now when I click on the 'All' button able to pull in everything. Yay but the other buttons it shows nothing in the gallery. 

    On the main gallery - Items, I had the following that worked between the 3 buttons. 
    Search( Filter(ccDataCollection,( varAll || StatusVAl in AssignedTo) && CycleDate >= DatePickerStart.SelectedDate , CycleDate<=DatePickerEnd.SelectedDate), txtSearchBox.Text, "Code", "Batch", "OwnerName", "LBox", "PayorName","Contract_No", "AssignedTo")

     

    'All' button: OnSelect: UpdateContext({varAll: true})
    'Assigned to me': OnSelect: UpdateContext({StatusVAl: varUser.displayName}); UpdateContext({varAll: false})

    'Unassigned': OnSelect: UpdateContext({StatusVAl: Blank()}); UpdateContext({varAll: false})
    -----------------------

    So, I tried this but like I said "All" is working but the other 2 buttons it shows 0 records in the gallery now.

     

    Search( Filter(ccDataCollection, galleryForButtons.Selected.Value = "All" || (galleryForButtons.Selected.Value = "Assigned to me" && StatusVAl in AssignedTo) , CycleDate >= DatePickerStart.SelectedDate , CycleDate<=DatePickerEnd.SelectedDate), txtSearchBox.Text, "Code", "Batch", "OwnerName", "LockBox", "PayorName","Contract_No", "AssignedTo")

     

    What am I missing here? Thank you

     

     

     

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Anonymous 

    Yes, you would want to account for all the conditions in your filter crtieria.

    The formula should be:

    Search( 
     Filter(ccDataCollection, 
     galleryForButtons.Selected.Value = "All" || 
     (galleryForButtons.Selected.Value = "Assigned to me" && varUser.displayName in AssignedTo) || 
     (galleryForButtons.Selected.Value = "Unassigned" && AssignedTo = Blank()), 
     CycleDate >= DatePickerStart.SelectedDate , 
     CycleDate<=DatePickerEnd.SelectedDate
     ), 
     txtSearchBox.Text, "Code", "Batch", "OwnerName", "LockBox", "PayorName","Contract_No", "AssignedTo"
    )
  • Community Power Platform Member Profile Picture
    on at

    Hi @RandyHayes 
    Sorry for the delay, yes this worked. Thank you again!!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard