cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
sharepointguy
Level: Powered On

Clear / Hide items in gallery after selection

I followed the video https://www.youtube.com/watch?v=xs_hWRNCwuA from @ToddBaginski to build a people picker control. I was able to build the exact same control except that when we select a user, the gallery is still showing the selected user. I want to achive the below behavior,

  1. User enters a first few characters in the search textbox.
  2. Gallery displays all users fulfilling the search criteria.
  3. User selects one of them.
  4. The Display Name is populated in the same search box.
  5. The gallery displays 0 items.

Do we need to do some extra steps to achive this? Also not sure how the video shows a hand cursor when hovered over the rectangle. I don't think we can get a hand cursor over shapres.

 

2 REPLIES 2
jhall
Level 8

Re: Clear / Hide items in gallery after selection

I haven't watched the video, but clearly on Step 4 you're putting the name into the same Search box that you are using as a Filter on your Gallery.  So if it contains the exact-match name of the person you clicked on (which you did in Step 3) it will display that matching item.

There are certainly several ways around this. 

First is just hiding the Gallery.  When you do your OnSelect for the Gallery you could also set a variable (e.g. UpdateContext({itemSelected:true})).  Then you can do the same for an OnChange for your Search text box (e.g. UpdateContext({itemSelected:false})).  Set the Visible property for the Gallery to be !itemSelected.

Again, I'm not clearly on the use-case (probably since I didn't watch the video), but you primarily just need to do something extra here to flag that something has been selected so now you want some different behavior to occur.

sharepointguy
Level: Powered On

Re: Clear / Hide items in gallery after selection

Hi @jhall ,

 

Appreciate your response. However, not sure why, OnChange doesn't seems to be reliable and many a times fires only when the focus is lost. I am still getting the desired functionality by putting the same code OnSelect. I also added a condition that if the selected user display name is same as what is already there in the search text box, the search user function will not fire.

I will still wait for a couple of day expecting a reply from @ToddBaginski on what exactly has he used in the demo. If not, I will mark your response as an answer.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 92 members 3,250 guests
Please welcome our newest community members: