Hi everyone. I have checkboxes incorporated in my gallery and a textbox which serves as "employee name search box".
The checkboxes allows users to select multiple rows and save them by batch. This is working just fine until I decided to type in something in the searchbox. The gallery searches for the employee but the initial items selected by the user got refreshed. All items selected by the users got unchecked.
Is there a way to not refresh/reset the checkboxes when the user searches for an employee name?
I have a filter in my gallery "textboxsearch.text in empnamecolumn"
1 - I select multiple items
2- I search for a particular employee name
3 - initial checked selection are gone when I clear the searchbox
Solved! Go to Solution.
Hi @keihimekawa ,
It sounds like:
In a scenario involving selection of items, it is best to hold the selection in a collection and not rely on the checkbox alone. Then you can set the Default property of the checkbox to see if it is in the collection. You will need actions on the checkbox to remove and add records to the collection upon checking and unchecking the box.
There's a good example of this pattern in the App in a Day workshop for Device Orders (see the PDF for Module 1):
Let me know if you were able to implement the checkbox behaviors.
Hi @keihimekawa ,
It sounds like:
In a scenario involving selection of items, it is best to hold the selection in a collection and not rely on the checkbox alone. Then you can set the Default property of the checkbox to see if it is in the collection. You will need actions on the checkbox to remove and add records to the collection upon checking and unchecking the box.
There's a good example of this pattern in the App in a Day workshop for Device Orders (see the PDF for Module 1):
Let me know if you were able to implement the checkbox behaviors.
@Mr-Dang-MSFTyou are awesome! It worked! Thank you so much for sharing the "App in a day" workshop files!
Hi @Mr-Dang-MSFT - I added radio buttons on the gallery and a textbox wherein users can enter a comment if they selected "No".
Radioboxes also resets just like the checkbox before. Should I do a patch function on the collection for Selected items? I tried doing this but apparently, new items are added on the collection. Aplogies if I have too many questions. I'm still trying to familiarize my way around PowerApps.
Hi @keihimekawa ,
When a gallery's Items change due to it being filtered/searched, the values that have been typed or selected in its controls change as well. Those values are not saved anywhere. We use collections so that even if the gallery changes, the values in the collection remain the same.
You would be on the right track in using the Patch() function. If you are selecting a radio control and typing into a text box, you would set the OnChange property of the control to Patch the values to the respective columns in the collection.
Some caveats here:
User | Count |
---|---|
185 | |
122 | |
91 | |
47 | |
42 |
User | Count |
---|---|
270 | |
158 | |
130 | |
84 | |
78 |