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 / Icon within gallery ex...
Power Apps
Answered

Icon within gallery executes on select even when disabled

(0) ShareShare
ReportReport
Posted on by 691

Hello all,

 

I have a very strange problem: I have a gallery, in which I have na icon control. The OnSelect of this icon is:

"Set(Edit_Record,!Edit_Record);Reset(DatePicker2)" - where Edit_Record is a boolean variable (Datepicker2 is not important).

The display mode of this icon is :
"If(ThisItem.IsSelected Or !Edit_Record,DisplayMode.Edit,DisplayMode.View)".

 

Basically, what I am trying to achieve is:

you click the incon on a selected row in the gallery and the icon becomes disabled for all other rows except the selected one.

 

The icon gets disabled but if I click on it, it still executes the OnSelect 😮

 

I've added a tooltip for the icon to actually check what is the status at every given line - status is showing disabled... but still if I press it, it executes OnSelect.

 

I've used the monitoring tool just to check what is going on - it shows that I am pressing the icon and PA successfully executes the OnSelect property.

 

I've tried everything that I can think if, but nothing helps...

 

Can someone suggest what the issue might be?

 

Thanks in advance.

Categories:
  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    You might consider using AddColumn with your data source in the Gallery Items property.   This column could be EditRecord.  Patch all items in the datasource so EditRecord is true

     

    In the OnSelect of the icon, patch EditRecord for all the other items to false.

     

    Set your DisplayMode like this:

     

    If(ThisItem.EditRecord, DisplayMode.Edit, DisplayMode.Disabled)

     

    You will need to reverse this of course when you are finished editing by patching the EditRecord to true for all the records.

  • PTBBSolutions Profile Picture
    691 on at

    Same thing... when I click on the button, although it is disabled, it still executes the OnSelect

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Let me make sure I understand what you are saying.   In your gallery if you click on the icon in another gallery item, it executes the OnSelect after it is disabled?

  • PTBBSolutions Profile Picture
    691 on at

    exactly

  • JR-BejeweledOne Profile Picture
    5,836 Moderator on at

    Double-check the other controls in the gallery and make sure that they don't have an OnSelect formula that matches the one on your icon.

     

     

  • Verified answer
    CU-18081211-6 Profile Picture
    9,272 Moderator on at

    @PTBBSolutions 

    If(ThisItem.IsSelected Or !Edit_Record,DisplayMode.Edit,DisplayMode.View)

    When you press anywhere inside a gallery row, even if the control you pressed is in View Mode, the current gallery row selected is updated to this row. 

    So, when you press an icon from gallery your formula is always true because ThisItem.IsSelected returns true.

    Please give it a try without ThisItem.IsSelected in formula. 

     

    Hope it helps !

  • PTBBSolutions Profile Picture
    691 on at

    @gabibalaban  Thank you very much. It makes perfect sense now. I Just have to figure-out something else.

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 236 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 207 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 169

Last 30 days Overall leaderboard