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 / How to manually sort a...
Power Apps
Answered

How to manually sort a Gallery inside a canvas app?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi everyone, 

 

Right now I have 2 gallery in front of me. In gallert A I have set up a multi selection gallery, where as the name suggest, I can select multiple items. I just need to click on a check box that is present on every item inside this gallery. 

Upon selection, the temporary collection will contain the selected items. I have a second gallery, gallery B. This Gallery will display the content of the selected items. 

Now what I want to achieve, is to be able to sort manually the order of the items inside this gallery B and change the order present inside the collection. So that when I patch the content of this gallery into a sharepoint list, it remains in the order that I have created. 

 

I would apprecaite all kinds of answers or hints. Many thanks. 

 

Please do tell me if anything I said was not clear enough. 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Anonymous 

    This will depend on the columns you want to sort by in the Gallery B

     

    For example, if you have a Date column in your Gallery A and you want Gallery B to sort on that date, then your Items formula on Gallery B should be:

    SortByColumns(
     Filter(GalleryA.AllItems, yourSelectionCheckBox.Value),
     "yourDateColumn"
    )

    Just substitute the column name you want to sort by in the formula and the names of your actual controls.

     

    I hope this is helpful for you.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for your prompt answer, but that is not really the result I am trying to achieve right now. What I want is not for the gallery to sort under a specific rule that I impose. What I want is for instance when you custom sort (manually sort) a music playlist. 

     

    In other words, in Gallery A I selected the items I want present inside Gallery B, but then inside gallery B, I can switch the position GalleryB.Item1 with Gallery.Item2 by perhaps (if its possible) dragging up or down. Do you get what I mean? 

     

     

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

    @Anonymous 

    Ah - gotcha!  Thank you for explaining.  I was not sure what you meant by manual sort.

     

    So, to do what you are trying, first, you will not be able to drag up and down as drag and drop operations are not available in PowerApps.  So you need to collect your selections from the first gallery.

    Then in GalleryB, you will need to supply a way to move up and down records.  This is normally done with an up and down arrow in the gallery.  For these type of order changes, I like to augment the records in the collection with a row number (and your gallery would be sorted by the row number).  Then in, for example, the Up icon, you would update the row number minus one in the collection and increment it, and then decrement the row number of the current record.  The sort on the Gallery will make it move without any further action.  The opposite would be true on the down button except you would decrement the row number plus one and increment the current row number.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you very much for your reply, I think I get the gist of it. Going to try to make this a thing now. Much appreciated. 

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 404

#2
timl Profile Picture

timl 344 Super User 2026 Season 1

#3
WarrenBelz Profile Picture

WarrenBelz 320 Most Valuable Professional

Last 30 days Overall leaderboard