cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lgpower
Helper II
Helper II

Select(Gallery,row,control) in OnSelect to select one items' button within gallery

Hi there, 

 

I have two navigation galleries. One for mobile one for horizontal layouts. Both galleries have the following items:

 

Table(
    {
        Title: "";
        Icon: "";
        Context: "logo"
    };
    {
        Title: "";
        Icon: "";
        Context: "vorigScherm"
    };
    {
        Title: "Startpagina";
        Icon: Icon.Home;
        Context: "showDashboard"
    };
    {
        Title: "Weekstaten";
        Icon: Icon.Clock;
        Context: "showMijnWeekStaten"
    };
    {
        Title: "Projecten";
        
        Icon: Icon.Folder;
        Context: "showProjecten"
    };
    {
        Title: "Urenoverzichten";        
        Icon: Icon.LogJournal;
        Context: "showGoedkeuren"
    };
    {
        Title: "Ploegen portaal";       
        Icon: Icon.People;
        Context: "showPloegen"
    }
)

 


Based on ThisItem.Context field actions are performed such as navigating and updating collections. 

 

In my mobile navigation I want to have the exact same actions. Of course I could just copy paste the OnSelect code but I think a cleaner solution would be to use Select(Gallery;Row;Control). Someting like this: 

Select(
NavigationVert;
LookUp(
NavigationVert.AllItems;
Context = ThisItem.Context
);
navigationSelectControl
)

Unfortunately I cannot get this to work. Is it possible to select a variable row+control from a button in another gallery? 


Thanks in advance. 

LGpower 

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @lgpower ,

 

You could insert a number column in your second gallery.

 

I assume that the formula in the items property of your second gallery control 'NavigationVert' is:

Table({AAA:"a";BBB:"b"};{AAA:"c";BBB:"d"};{AAA:"e";BBB:"f"})

 

 

So, you should change the above formula to:

Table({AAA:"a";BBB:"b";Numbercolumn:1};{AAA:"c";BBB:"d";Numbercolumn:2};{AAA:"e";BBB:"f";Numbercolumn:3})

 

Then you could use this formula:

Select(
NavigationVert;
LookUp(
NavigationVert.AllItems;
Context = ThisItem.Context
).Numbercolumn;
navigationSelectControl
)

 


Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

4 REPLIES 4
rubin_boer
Super User
Super User

hi @lgpower just to clarify, when you click on the item you wish the navigation to take you to the form as per Context? if this is the case:

on the Onselect of the gallery, OnSelect = Navigate(ThisItem.Context,Transition.cover)

 

If you looking for something else, please explain a bit more.

 

hope this helps

 

Hi @rubin_boer,


Thanks for your reply.

Actually, I have most galleries within same screen. So one of the actions in the OnSelect is OnSelect = UpdateContext({showScreen:ThisItem.Context}) 

 

But yes, that is the general idea. 

So this works for the Vertical Nav (no issues navigating what so ever).

What I am trying to achieve is  the same behaviour in the horizontal Nav using OnSelect = Select(verticalNav,Row/Column,Control) 



rubin_boer
Super User
Super User

@lgpower im not 100% with you, do you mean the vertical control of the gallery itself?

 
v-xiaochen-msft
Community Support
Community Support

Hi @lgpower ,

 

You could insert a number column in your second gallery.

 

I assume that the formula in the items property of your second gallery control 'NavigationVert' is:

Table({AAA:"a";BBB:"b"};{AAA:"c";BBB:"d"};{AAA:"e";BBB:"f"})

 

 

So, you should change the above formula to:

Table({AAA:"a";BBB:"b";Numbercolumn:1};{AAA:"c";BBB:"d";Numbercolumn:2};{AAA:"e";BBB:"f";Numbercolumn:3})

 

Then you could use this formula:

Select(
NavigationVert;
LookUp(
NavigationVert.AllItems;
Context = ThisItem.Context
).Numbercolumn;
navigationSelectControl
)

 


Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PWREduCon768x460.png

Join us at PWR EduCon - A Power Platform Conference

Learn from the top Power BI, Power Apps, Power Automate & Power Virtual Agents experts!

Top Solution Authors
Top Kudoed Authors
Users online (3,118)