cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Prodigy
Post Prodigy

Search bar unchecks checkboxes

Capture.PNG

When I use the two search bars above my checkboxes uncheck itself. How can I make the checkbox choices stay selected?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @powerapps890 ,

Could you please share more details about scenario?

Do you mean that when you use two Search bar in your app, the Checkbox control reset itself?

Further, do you add the Checkbox control inside your Gallery?

 

I found that you have posted similar issue within our community, please check the following thread:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Add-searchbar/td-p/624955

 

According to the issue that you mentioned, I guess that you added the Checkbox control inside the Gallery, and when you type some search text in the two Search bar, the previous selected checkbox items in your Gallery would be reset, is it right?

 

If above is your issue, actually, it is an normal behavior in canvas app. When you type some search text within the Search bar, the Gallery Items would be updated/refreshed, so the Checkbox inside the Gallery would also be reset.

 

As an fixed solution, you could consider set up a Collection to store the Checkbox selected item from your Gallery, then you could set the Default property of the Checkbox against if the item is already existed in the collection Table.

I have made a test on my side, please try the following workaround:

Set the OnCheck property of the Checkbox control inside your Gallery to following:

Collect(
        TempCollection, 
        ThisItem.'Primary Key Column'
)

Set the OnUncheck property of the Checkbox control inside the Gallery to following:

RemoveIf(
         TempCollection,
         Value = ThisItem.'Primary Key Column'
)

Note: The 'Primary Key Column' represents the Primary Key column in your CCB data source, which could identify single one record.

 

Set the Default property of the Checkbox to following:

If(
   ThisItem.'Primary Key Column' in TempCollection.Value,
   true,
   false
)

 

Please consider take a try with the above solution, hopes it could solve your problem.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Super User III
Super User III

Hi @powerapps890 ,

This is the same post and this one which I just answered. Please close this one.

Community Support
Community Support

Hi @powerapps890 ,

Could you please share more details about scenario?

Do you mean that when you use two Search bar in your app, the Checkbox control reset itself?

Further, do you add the Checkbox control inside your Gallery?

 

I found that you have posted similar issue within our community, please check the following thread:

https://powerusers.microsoft.com/t5/Building-Power-Apps/Add-searchbar/td-p/624955

 

According to the issue that you mentioned, I guess that you added the Checkbox control inside the Gallery, and when you type some search text in the two Search bar, the previous selected checkbox items in your Gallery would be reset, is it right?

 

If above is your issue, actually, it is an normal behavior in canvas app. When you type some search text within the Search bar, the Gallery Items would be updated/refreshed, so the Checkbox inside the Gallery would also be reset.

 

As an fixed solution, you could consider set up a Collection to store the Checkbox selected item from your Gallery, then you could set the Default property of the Checkbox against if the item is already existed in the collection Table.

I have made a test on my side, please try the following workaround:

Set the OnCheck property of the Checkbox control inside your Gallery to following:

Collect(
        TempCollection, 
        ThisItem.'Primary Key Column'
)

Set the OnUncheck property of the Checkbox control inside the Gallery to following:

RemoveIf(
         TempCollection,
         Value = ThisItem.'Primary Key Column'
)

Note: The 'Primary Key Column' represents the Primary Key column in your CCB data source, which could identify single one record.

 

Set the Default property of the Checkbox to following:

If(
   ThisItem.'Primary Key Column' in TempCollection.Value,
   true,
   false
)

 

Please consider take a try with the above solution, hopes it could solve your problem.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Yes, when I use the search bars the checkboxes uncheck. The primary key is not recognized when I tried that. @v-xida-msft 

Hi @powerapps890 ,

Could you please share a bit more about your issue?

 

Based on the needs that you mentioned, I think the solution I provided above could achieve your needs. Please check if you have referenced proper "Primary Key" column in your Collect function.

 

If your data source is a SP List, the "Primary Key" column would be the "ID" column. If your data source is a SQL Table, the "Primary Key" column would be the Primary Key in your SQL Table. The "Primary Key" column is just a sample column name, you need to replace it with actual column name from your data source itself.

 

Please replace the "Primary Key" column with actual column name from your data source (the Gallery connects to), then re-try the formula I provided above, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

I got it to work. There is just one problem in default I already have If(ThisItem.Name in Filter('CCB Voting','Name_'=User().FullName).Title, true,false) which takes the previously checked boxes and loads them in. How can I have both of the default statements in there at the same time? @v-xida-msft 

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (17,295)