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 / Highlight a row within...
Power Apps
Answered

Highlight a row within gallery

(1) ShareShare
ReportReport
Posted on by 240

Hello Everyone 🙂

 

I would like to highlight a row in my gallery if it is selected,

 

In particular if the info icon of that row is selected, is this possible?

 

Appy1_0-1677753539355.png

 

I would also need a way of clearing the row selection when the person has finished navigating/selecting.

 

Many Thanks

Chris

Categories:
  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Ok so that looks like a nested gallery, which might make things a bit more complicated.. let's try the simple approach first

     

    What I would do is have your info icon set a variable relating to ThisItem, and because you want it to toggle on or off being selected, we will need to include that in the formula:

    Set(
     CurrentlySelectedItem,
     If(
     CurrentlySelectedItem.ID = ThisItem.ID, 
     Blank(), 
     ThisItem
     )
    )

     

    Then set the Fill property of your row to:

    If(
     ThisItem.ID = CurrentlySelectedItem.ID,
     // This is a transparent red
     RGBA(255,0,0, 15%),
     // If this is not the selected item, just use a transparent background
     Transparent
    )

     

    Could you give this a try and then let me know how it goes?

     

    Cheers,

    Sancho

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Appy1

    Use the template fill property of the gallery to highlight the record: 

    If(ThisItem.IsSelected, Red, Transparent).

    To clear selection:

    Add a + icon

    1. Set the default property of Gallery1 to {}.

    2. And then on the OnSelect property of the + icon: Reset (Gallery1) 

  • CC-19121430-0 Profile Picture
    240 on at

    Hello, @Drrickryp , 

     

    Thanks for the suggestion.

     

    Unfortunately it doesn't seem to work, it hasn't highlighted anything.

     

    Kind Regards

    Chris

  • CC-19121430-0 Profile Picture
    240 on at

    Hello @iAm_ManCat ,

     

    Thanks for this, i will give it a go.

     

    Im assuming i add this to the OnSelect property of the Icon?

     

    I currently have this there for my popup, are you able to advise on how would i incorporate this?

     

    Set(
    DisplayPopup,
    true
    )

     

    If it is easier an row could be highlighted by any text input within that row being clicked i would also go for that option.

     

    Really appreciate your help.

     

    Thanks

    Chris

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    Yeah of course, happy to explain - and yes you are correct, on the OnSelect
    You should be able to have it do multiple items by adding ; as the separator

    Set(DisplayPopup, true);
    Set(
     CurrentlySelectedItem,
     If(
     CurrentlySelectedItem.ID = ThisItem.ID, 
     Blank(), 
     ThisItem
     )
    )

     

  • CC-19121430-0 Profile Picture
    240 on at

    @iAm_ManCat 

     

    I have entered the formulas but have encountered an error on the OnSelect of the Icon.

     

    This is what it says:

     

    Appy1_0-1677759557991.png

     

     

    Kind Regards

    Chris

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    do the items at that level have an ID field?

  • CC-19121430-0 Profile Picture
    240 on at

    Hello @iAm_ManCat 

     

    I am very sorry, im not quite sure what you mean?

     

    Kind Regards

    Chris

     

     

  • iAm_ManCat Profile Picture
    18,256 Most Valuable Professional on at

    You would be using some kind of datasource or collection to drive this gallery, which is what we have set to ThisItem - well what makes each row unique - in the code I gave I assumed you had an ID for us to compare the values, but we can use other fields depending on what you have available.

    The error says that the items both resulted in Error, meaning they don't have an ID field which is what I used to compare them

  • CC-19121430-0 Profile Picture
    240 on at

    Thank you - @iAm_ManCat , i understand i think now. Sorry im not quite sure on all of the terminology just yet.

     

    I don't have an ID column setup, im using an excel file saved within Sharepoint as my data source.

     

    I would have hopefully other fields that i could use for this? my gallery is a series of text inputs that are forming my table. Would one of these be suitable as a replacement for the 'ID'?

     

    Thanks

    Chris

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard