cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BrianHFASPS
Responsive Resident
Responsive Resident

Gallery with Toggle / Checkbox inside each item not working

I have done this before and I am trying to do it in a new app and it keeps breaking. I have a gallery that is displaying a collection. That collection called PartRoster that has in it a column that is called PartTrack for example. The toggle or checkbox is meant to be able to update that value in the collection. I have in OnUnCheck - Patch(PartRoster,ThisItem,{PartTrack:false}) and OnCheck - Patch(PartRoster,ThisItem,{PartTrack:true}). If I have either OnCheck or OnUnCheck active with those commands and the other with just false it works. If I populate both the control stops working. It is permanently true and if I attempt to toggle it just flips back.

 

Like I said I have done this in other programs and tested those today. I am missing something obvious but I can't figure out what? Thanks for any help.

5 REPLIES 5
WarrenBelz
Super User III
Super User III

Hi @BrianHFASPS ,

You are not missing something - I recreated what you have done on a test list and got the same equally strange behavior. A control not linked to any data resetting itself after an event - quite bizarre. I got something working as below - quite clunky, but it seems to mostly do what you need - the label is the value in the table.

CheckBoolean.gif

 

 

 

 

 

 

 

The OnCheck is

Patch(
   PartRoster,
   ThisItem,
   {PartTrack:true}
);
Refresh(PartRoster);
UpdateContext({vCheck:true})

OnUncheck

Patch(
   PartRoster,
   ThisItem,
   {PartTrack:false}
);
Refresh(PartRoster);
UpdateContext({vCheck:true})

Default of the checkbox

If(
    ThisItem.IsSelected,
    vCheck
)

I also tried

If(
    ThisItem.IsSelected,
    vCheck,
    ThisItem.PartTrack
)

with different clunky results.
I am wondering whether it would not be easier to put a toggle on linked to the current value and simply patch this back.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Thanks for double checking. The one piece I forgot to mention in my original post is I have some places in my apps that it works fine? I have an older app that has this functionality in 3-4 places. 2 work for sure and 1 for sure doesn't. Then I have the new app I am building and it doesn't work there. I recorded a video of it to show it in action. It is 3 minutes long if you have a moment to check it out and see if you see something I am missing. I obviously did something different in one than the other but I can't figure out what?

PowerApps Toggle Issue Video

I have made some progress. I determined two fixes. One, the Default must be set to collection column rather than true/false. That creates the wonky behavior with the checkboxes. Two, using the toggle like this just doesn't work. When I switched my new app to checkboxes it just works. If I try to use toggles it flickers and won't work. Maybe the toggle just can't work that way?

Hi @BrianHFASPS ,

Yes - I just got an endless loop on the toggle. as well.

I created a support ticket and they confirmed they are seeing the same behavior. The question now is if it is deemed "working as designed" or a bug. For now I have moved on with checkboxes so I can my app deployed and in use.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

Top Solution Authors
Top Kudoed Authors
Users online (2,368)