cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
TezzChaudhary
Level: Powered On

Gallery, set default selection to first item

I am having 2 Galleries, the one is 'Filter Gallery' and the second one is 'Filtered Items'. The Filter gallery works until I Select any Item in Filter Gallery. What I need is to show All Items in 'Filtered Items' by Default. 

7 REPLIES 7
Super User
Super User

Re: Gallery, set default selection to first item

Hi TezzChaudhary,

 

The image you attached comes up with an error, and your subject seems to be different to what you've said in your message so I'll try answer with what I know.

 

For the request in the subject "set default selection to first item";

You can do this by setting the Default property of the FilterGallery to

First(FilterGallery)

If your FilteredItems Gallery is based on what is selected in the FilterGallery, then it should automatically filter based on the above - but it depends on the your Items property function.  What is it set to?

 

Bear in mind the "Default" parameter is triggered on reset, so if you wish to reinforce the default after the first time the page is rendered, you would need to use the Reset property of the Gallery and trigger it manually.

 

To your second question;

"The Filter gallery works until I Select any Item in Filter Gallery. What I need is to show All Items in 'Filtered Items' by Default. "

I'm not sure what you mean by 'works until I select any item in the filter gallery'.  

 

Can you try upload the image again?

 

Kind regards,


RT

TezzChaudhary
Level: Powered On

Re: Gallery, set default selection to first item

Thanks for reply RT, Actually I was trying to ask for set default selection to the first item in a gallery. The second Question is an issue actually, the filtered items show a blank screen until I click on any item of Filtered Gallery, as You can see in my attached Image.

Also, First(tableName) didn't work for me.

 

Thanks

Super User
Super User

Re: Gallery, set default selection to first item

Hi TezzChaudhary,

 

It may be because the Default property is only used for first-time-render or Reset.  You won't trigger Default again unless you restart the app, or manually reset the gallery.

 

 

To test with a manual reset, add a button to the screen and set it's OnSelect property to;

Reset(FilterGallery)

 

Make sure the Default property of FilterGallery is set to

First(DataSourceName)

Where DataSourceName is identical to the Items: property value of the Gallery.

 

As an additional debug option, you can place a text label on the screen and set it's Text property to;

FilterGallery.Selected.

and pick a field from the record (eg: FilterGallery.Selected.Title or FilterGallery.Selected.ID) - but you already have a gallery based on FilterGallery.Selected so you probably don't need the text label.

 

 

Run the screen and select a few different items to see if your label and/or items gallery updates properly.  Then hit the button to see if it resets the selection it to the first item and updates the items gallery.

 

Kind regards,

 

RT

Super User
Super User

Re: Gallery, set default selection to first item

Hi @TezzChaudhary,

 

Could you paste your code for the Items property of both of the Galleries, I have a feeling it will be around the filtering part that your issue arises.

Without seeing your code I can only give you a general idea, but would help a lot if I could see what you have set up.
You should be able to do something like this:

SortByColumns(
   Filter(
      Properties,
          GalleryFilter = FilterGalleryDropDown.Selected.Value,

          (
               FilterItems.Selected.Value = "All Items"
               ||
               Title = FilterItems.Selected.Value
          )
  ),
"Title",
Ascending
)

 

 

The Logic with this being that you are either filtering by the selection "All Items" which then returns 'true' and shows all items instead of filtering, or you are filtering by whatever item has been selected.

 

Cheers,

@iAm_ManCat




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!
TezzChaudhary
Level: Powered On

Re: Gallery, set default selection to first item

SortByColumns(If(type="All",Tickets,If(type="Closed", Filter(Tickets,Status="Closed"),If(type="Active",Filter(Tickets,Status="In Progress"),If(type="On hold",Filter(Tickets,Status="On Hold"),If(type="Not started",Filter(Tickets,Status="Not Started")))))),"Created",Descending)

The Above code is of Items property of Filtered Gallery(Here 'Tickets' is a SharePoint List), while in Filter Gallery I am just calling a SharePoint List

Community Support Team
Community Support Team

Re: Gallery, set default selection to first item

Hi @TezzChaudhary,

Do you want to set the default selection to the first item of your data source within your Filter Gallery?

I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:4.JPG

For your first question, if you want to set the default selection to the first item of your data source within your Filter Gallery, please take a try with the following workaround:

Set the Default proeprty of the Filter Gallery control to following:

First(TicketTypes)

Note: The TicketTypes represents the data source you typed within the Items property of the Filter Gallery.

 

For your second question, do you use your SP list data source within the "Filtered Items" Gallery (Tickets Gallery) of this template app (Service desk) instead of Original embedded Excel table?

The Original embedded data sources (e.g. TicketTypes, Tickets, etc) within this template app are all Excel table data source as below:5.JPG

If you want to replace the Original embedded Excel table data source with your SP lists within this template app, please make sure your SP lists have same data structure as that within the Original embedded Excel table data sources as below:6.JPG

 

7.JPG

On your side, you could consider take a try to save this embedded Business Excel table data sources into your OneDrive folder (or OneDriver for Business, Dropbox, etc), then create your SP lists based on the data structure of these embedded Business Excel tables. After that, add your SP lists into this template app, then save and re-load this template app to check if the issue is solved.

Note: You could find the embedded Business Excel tables through the following folder path:

Your OneDrive Root folder -> PowerApps folder -> Templates folder -> ServiceDesk_eaxxxxxx-de38-xxxx-b1d7-58ef8d75xxxx -> data.xlsx

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
TezzChaudhary
Level: Powered On

Re: Gallery, set default selection to first item

Thanks @v-xida-msft

 

I have already tried that Solution but it didn't helped me.

 

"do you use your SP list data source within the "Filtered Items" Gallery (Tickets Gallery) of this template app (Service desk) instead of Original embedded Excel table?"

Actually I created this app from scratch, using SP list as a data source.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 198 members 5,486 guests
Please welcome our newest community members: