cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Disabling button in a gallery.

Hi, 

 

I have a gallery connected to CDS Account records.  I have a field in account called "Picked".  If Picked = Blank, then the button is disabled, otherwise it's not.

 

When I press the button, I update the record so that Picked is not blank.  But "auto-disable on select" time isn't long enough for the refresh of data, so the button isn't disabled and the users think that it hasn't worked so press again and again and again...

 

Does anyone have a better idea of how I can do this?

 

Thanks...

 

John

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Advocate II
Advocate II

Re: Disabling button in a gallery.

How about adding another context variable that is set to that Item? Say your gallery cards are demographics (name, title, manager). Then when a change is made for that control within the item, you can set the OnSelect to UpdateContext({conMode:Disabled , conItem:ThisItem.Demographic}) then the control's display mode could be If(ThisItem.Demographic=conItem,conMode,Edit)

View solution in original post

8 REPLIES 8
Highlighted
Advocate II
Advocate II

Re: Disabling button in a gallery.

One tactic I often try when a user is making changes is set all the buttons and fields display mode to a context variable. When the screen is first opened I add UpdateContext({conMode:Edit}) to the OnVisible property. Then I enclose any OnSelect action with UpdateContext({conMode:Disabled}) as the beginning and then UpdateContext({conMode:Edit}) at the end. Then you can set the DisplayMode of the control to conMode.

 

image.png

 
Highlighted
Helper II
Helper II

Re: Disabling button in a gallery.

Thanks for the reply!

 

Yea I thought about doing something similar.  The problem is that the button is part of a gallery card, so doing that will set all the buttons for all the items in the gallery to Edit/Disabled.

Highlighted
Advocate II
Advocate II

Re: Disabling button in a gallery.

Hey, great minds, am I right?

 

If you only want some of the buttons to be disabled, then you could either only apply the conMode to the buttons that you want disabled while they're waiting on a response or setup a different conMode for each button that you want that functionality for. So you could have a ConModeName, ConModeTitle, ConModeManager....

 

Another thing that I often do is instead of disabling the controls I just add a label that takes up the entirety of the app and in the text have "Please wait while your data is being saved". Though that might be better suited for a form where you wait till the end to save as opposed to a single control/change.

Highlighted
Helper II
Helper II

Re: Disabling button in a gallery.

Haha absolutely!

 

As I mentioned though, the button is within the gallery "card" (not sure if that's the right terminology) so the button appears in all items in the gallery.  So there's no way I can think of that using a variable that would only disable the button that's been pressed?

 

Hope that makes sense.

Highlighted
Advocate II
Advocate II

Re: Disabling button in a gallery.

How about adding another context variable that is set to that Item? Say your gallery cards are demographics (name, title, manager). Then when a change is made for that control within the item, you can set the OnSelect to UpdateContext({conMode:Disabled , conItem:ThisItem.Demographic}) then the control's display mode could be If(ThisItem.Demographic=conItem,conMode,Edit)

View solution in original post

Highlighted
Community Support
Community Support

Re: Disabling button in a gallery.

Hi @BigJohn ,

 

Is your purpose to updating the record with value must be contained in Picked field? If so, you could workaround this by setting below formula in the OnSelect property of the button:
If(!IsBlank(ThisItem.Picked),Patch(....),Notify("Picked mustn't be empty",NotificationType.Error)))


Regards,

Mona 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Helper II
Helper II

Re: Disabling button in a gallery.

Hi BegeNCSU,

 

Thanks for that.  I did as you said and created another context variable of the item called pickedItem, then on the Display Mode of the button I did:

If(pickedItem.Account = ThisItem.Account, DisplayMode.Disabled, If(!IsBlank(ThisItem.Picked), DisplayMode.Disabled, DisplayMode.Edit))

This has brought it's own little quirks but for the most part it's what I wanted to achieve.

 

Thanks for all your help!

 

John

Highlighted
Advocate II
Advocate II

Re: Disabling button in a gallery.

Great to hear, keep plugging away!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,514)