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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / CheckBox tick disappea...
Power Apps
Answered

CheckBox tick disappearing after selected

(0) ShareShare
ReportReport
Posted on by 5

 

 

Hello.

 

I have a gallery that is used to export the selected item to CSV. 

 

On the Checkbox

OnChecked 

Patch(colDWB, ThisItem, {IsChosen: true})

OnUncheck

Patch(colDWB, ThisItem, {IsChosen: false})

 

For testing purpose i have added the field IsChosed to the gallery. 

 

When a checkbox is ticked it is changing this to true as yo can see on record 1321 and 1320

When i refresh the data it is then setting them all back to false 

 

But the strange thing that i can not seem to workout is why the CheckBox is not remaining ticked 

 

amyharkus1986_1-1614774434597.png

So i changed the default on the checkbox to 

If(ThisItem.IsChosen = "true",true, false)

after reading someone else post on here i tried the above to no success. 

 

On a second point id like to add a tick box or button to select all, This way when the user filters to and from on the above filter and it displays the items only for the selected period they can the select all to export all those within the filter.

 

Many Thanks. 

 

Categories:
  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @amyharkus1986 

    Get rid of the If(). A checkbox is only true or false. For a field in your datasource named IsSelected, the default property of the checkbox is simply IsSelected. You are using a collection but if the field is not in the datasource for the collection, then when you "refresh" or probably ClearCollect colDWB the checkbox value resets because it isn't in your datasource.. 

    FYI checkboxes are one of only 4 controls that don't require any further specification. The control's name is the value. The others are toggle, slider and rating. 

  • amyharkus1986 Profile Picture
    5 on at

    @Drrickryp Thank you, for me it was 

    ThisItem.IsChosen

    All working now.  

  • RusselThomas Profile Picture
    4,014 on at

    Hi @amyharkus1986 ,

    SPO Yes/No columns are boolean, so you should be able to just use a proper boolean true instead of a text "true" - in which case your default property for the checkbox can be;

    ThisItem.IsChosen

    You can enable "Check all" and "Uncheck All", but you may also want to add a "Reset All" button, as checking or unchecking all clears the defaults of the current items.  Also, be aware this changes the user experience.  Checking all items using a variable will not trigger their OnCheck: property - that still needs to be done - in which case you may want to introduce an "update all" button as well.  Plus, if you want to reset them back to their default values (what's stored) after using check/uncheck all, "Reset All" helps.  I'm not going to go through all the permutations, but this should get you started;  

    Add a checkbox outside the Gallery and call it something like "chkAll". 

    Set both it's OnCheck: and OnUncheck: properties to;

    UpdateContext({varUsedReset: false})

    This ensure that as soon as someone uses it, it resets your varUsedReset variable.

     

    Add a Reload icon outside the Gallery and call it something like "icnResetDefaults".

    Set it's OnSelect: property to;

    UpdateContext({varUsedReset: true})

    This will allow you to set all your checkboxes back to what each rows IsChosen value is.

     

    Now, set the Default: property of your checkbox inside the gallery to;

    If(varUsedReset, ThisItem.IsChosen, Checkbox4.Value)

     

    You should notice you can check and uncheck all, and reset back to defaults - but you need to still cater for an update all function as checking all won't update your source this way - unless you want the "check all" checkbox to automatically go and update the source for all items...which could be tedious as users might also want to "Check All" and then go and manually uncheck some items - here again, you may have set a previously unset checkbox with CheckAll, but when they come to uncheck it manually, it will still go and patch the source with a false value, even though it's already blank or false.

    You need to play around with the logic to get the experience you want 😊  

    Hope this helps,

    RT

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard