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 / Deleting row causes ga...
Power Apps
Answered

Deleting row causes gallery to change to another selection

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi,

 

I have a gallery (Gallery 1) that is filtered from the selection of a gallery (Gallery 2) on the previous screen. I have a button that deletes a row from the Gallery 1 (a sharepoint list row). The delete function works fine, but my Gallery 1 is reset to a different selection from Gallery 2. Below is a gif of it happening, notice how the row isn't just deleted but resent to a different data input.

 

ezgif.com-video-to-gif (1).gif

Categories:
I have the same question (0)
  • Vijay Tailor Profile Picture
    2,961 on at

    Hi @Anonymous ,

    Can you please describe the issue in more detail with the reference code?
    But for Remove Rcord you can use like below code - 

    Remove(Clollection/ListName,ThisItem);

    and Please cross-check on the remove button you are not resetting the Parent gallery. Maybe that is the reason if you resetting.

    Thanks,

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @VijayTailor 
    You have to watch the gif. The delete is not the problem, my gallery resetting to another item is

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @VijayTailor 

    Sorry, I didn't see the second half of your reply. below is the "OnSelect" formula. I don't have any resets in it. Could that be in another area?

     

    Remove.PNG

    Also, heres a picture of the Powerapps Monitor. The 'delereRow' is being followed by a 'getRows', which seems to putt a different set of rows than what i started with

    remove 2.PNG

  • Vijay Tailor Profile Picture
    2,961 on at

    Hi @Anonymous ,

    You can do one thing.
    try like this
     ( Like - ThisItem, Not Galry.Selected)

    See the reference below - 

    Remove(TestAkshay,ThisItem)

    RemoveIssue.gif

    Thanks,
    Vijay 
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @VijayTailor 

    It doesn't come as an option because I'm putting a (Yes/No) menu inbetween. Again, the delete function works fine, its just that it refreshes my gallery to a different item than I had originally entered after

  • Vijay Tailor Profile Picture
    2,961 on at

    Hi @Anonymous , 

     

    You are trying to refreshing data source after row removed. Can you check plz, may that is also the reason of refresh gallary. 

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I think I found someone with a similar problem. I might be able to make this work.

     

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Bug-Gallery-with-calculated-values-will-lose-Selected-index-when/m-p/161150#M54252

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    The reason your gallery is losing its selected item is because you are altering the underlying datasource that it is associated with.

    The referenced posting you have will give you a workaround, but keep in mind that after that, referring to the Galleryx.Selected property will no longer be accurate.

    You can certainly attempt to implement that or you can consider using the Default property of the Gallery to maintain the selection to a selected value.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @RandyHayes,

     

    I'm looking into the Default section as a solution. I'm running into a problem though, the Default says its expecting a "Record" but I need a table of results to return in the Gallery

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    No, Default on a Gallery is a Record ONLY.  It is not a table.  The table is the Items property, the Default is the EXACT record in that items table to be selected.  The default is only one record because you can only have one record selected in a gallery at a time.

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
WarrenBelz Profile Picture

WarrenBelz 396 Most Valuable Professional

#2
11manish Profile Picture

11manish 134 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 101 Super User 2026 Season 2

Last 30 days Overall leaderboard