web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to manually sort a...
Power Apps
Unanswered

How to manually sort a Gallery inside a canvas app?

(0) ShareShare
ReportReport
Posted on by

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,297 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
    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,297 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
    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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard