cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Qb00ne
Frequent Visitor

Gallery - Uncheck checkbox for selected item only

Hi guys,

 

I have to galleries. 1st it the main one where I have checkbox option. And the 2nd is gallery with some details of selected item, and here I have X button. I am searching for the way to uncheck (untick) only currently selected item when user click on X button. 

 

Qb00ne_0-1606741171198.png

After click on X

Qb00ne_1-1606741212316.png

 

Thank you in advance!

Best Qb00ne

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Qb00ne 

It's a little tricky because you are trying to alter a control in a gallery. 

Here's how you can go about it.

 

On your X icon, place this formula in the OnSelect:

    UpdateContext({lclUncheck:true})

 

In your Gallery, place a Toggle control (let's call it tglResetCheck).  You can make this control not visible.  

Set the Default property of the Toggle to the following:

    ThisItem.IsSelected && lclUncheck

Set the OnCheck Action of the Toggle to the following:

    UpdateContext({lclUncheck:false})

 

Now, set the Reset property on the Checkbox control in your gallery to the following formula:

    tglResetCheck.Value

 

This should give you what you are looking for.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

2 REPLIES 2
RandyHayes
Super User
Super User

@Qb00ne 

It's a little tricky because you are trying to alter a control in a gallery. 

Here's how you can go about it.

 

On your X icon, place this formula in the OnSelect:

    UpdateContext({lclUncheck:true})

 

In your Gallery, place a Toggle control (let's call it tglResetCheck).  You can make this control not visible.  

Set the Default property of the Toggle to the following:

    ThisItem.IsSelected && lclUncheck

Set the OnCheck Action of the Toggle to the following:

    UpdateContext({lclUncheck:false})

 

Now, set the Reset property on the Checkbox control in your gallery to the following formula:

    tglResetCheck.Value

 

This should give you what you are looking for.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
dariobois
Resolver II
Resolver II

Hi, 

Is the "checkbox" control binding directly from a item field? in that case, just use the patch function in the "OnSelect" event of the "X" button to update the "boolean" field of the Galery Selected Item.

 

Regards!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

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