I have a gallery which will display the available time in white and the non-available time in grey. However, I would like to disable all the colors that are grey to prevent the users from selecting that specific time slot. Is this possible ?
In the gallery button, I set the button color to this:
If( ThisItem.Name in CollectionFakeHours.Name, RGBA( 77,168,184,100), RGBA( 187, 187, 187, 100) )
However, instead of making the non available colors grey, I would rather have them disabled instead.
You can do that using the DisplayMode property of the button. Set your condition for it to be either Edit or Disabled.
You cannot disable the items strictly speaking, but you can work around it. (You can't reference ThisItem directly on the Gallery Item Template's DisplayMode)
Without knowing more of your app, it's hard to tell the best way.
The selected item is probably being referenced by other objects or a Form.
One way around would be to completely cover your gallery item (inside the item, so it repeats per item) with a blank label, ordered on top, which would NOT have a Select(Parent) action. Make rules on the height and width of this label. On enabled items, the height and width of this label would be 1,1. On disabled items, it would be Parent.TemplateWidth and Parent.TemplateHeight, making it impossible to trigger OnSelect().
Or, you can change the Gallery OnSelect populate a variable, a set, or ClearCollect() the selected item into an intermediate collection, and have your other objects or forms look at that instead. Your OnSelect would be conditional, so it only populates if certain conditions are met.
The first is simpler as you only add 1 object to the gallery item, but the second provides more variables which may end up being more useful/flexible in the long run.
Check out this other thread discussing this same topic. I followed @VijayTailor's suggestion
Grouping the gallery item fields worked great for me. I was able to change gallery items that were updated to DisplayMode.Disabled. I grouped everything in the gallery item and set a conditional statement for its display mode - If('Text' in Table.Column, DisplayMode.Disabled, DisplayMode.Edit). So, if the 'text' from my gallery item appears in the updated column of my separate update table then that gallery item will be disabled. Good luck!
Check out the News & Announcements to learn more.
Did you know that you can visit the Power Query Forum in Power BI and now Power Apps
Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.
Check out our new Discover Your Career Path blog post series and get all the details.