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.
Thanks !
Hi @DevMolly100
You can do that using the DisplayMode property of the button. Set your condition for it to be either Edit or Disabled.
If(condition1=Somevalue,Disabled,Edit)
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
- https://powerusers.microsoft.com/t5/Building-Power-Apps/Disable-item-in-gallery/m-p/886937#M281623
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!
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Power Platform release plan for the 2022 release wave 2 describes all new features releasing from October 2022 through March 2023.
User | Count |
---|---|
206 | |
97 | |
60 | |
51 | |
45 |
User | Count |
---|---|
258 | |
158 | |
85 | |
79 | |
58 |