cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Super User
Super User

COMPONENTS: Set Gallery Default based on screen?

Hello,

I have a menu component that I like to drop into new apps. The menu consists of a Gallery of screen names. When user clicks on a screen name, they navigate to that particular screen. No problems here.

Issue:

  • The Gallery Default property is set to `{}` (blank)
  • I need it set to the current Screen

I can't quite figure out how to access a sreen control name through a Component.
Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: COMPONENTS: Set Gallery Default based on screen?

Hi @seadude 

 

Can you try to modify few properties as:
Component Custom Property (cmpMenuItems) placeholder code:
Table({screen: App.ActiveScreen, screenName: "Home", icon: Icon.Home })
 
Component Gallery Default property:
LookUp(Component1.CustomProperty1,screen = App.ActiveScreen)
 
Component Gallery Icon OnSelect property:
Navigate(LookUp(Component1.CustomProperty1,screenName = ThisItem.screenName).screen)
 
I carried out a test on my side and using below properties the component was working fine. There was no need for selecting the icon twice.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

4 REPLIES 4
Dual Super User
Dual Super User

Re: COMPONENTS: Set Gallery Default based on screen?

Hi @seadude 

 

I carried out a test on my side and you can use below expression on the "Default" property of your Gallery control:
 
Expression: {Value: App.ActiveScreen.Name}MicrosoftTeams-image (196).png

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Super User
Super User

Re: COMPONENTS: Set Gallery Default based on screen?

Hi @yashag2255 , Thank you very much for the assistance! The menu must be clicked two times to "stick". Can you tell why?

Scenario:

  • Component Custom Property (cmpMenuItems) placeholder code:
    Table({screen:"Test", screenName: "SampleText", icon: SampleImage})
  • Component Gallery Items property:
    componentName.cmpMenuItems
  • Component Gallery Defualt property:
    {screen: App.ActiveScreen.Name} // Requires clicking twice 
  • Component Gallery OnSelect property:
    Navigate(
        LookUp(colMenuItems,
            ThisItem.screenName = screenName, screen
        )
    )
  • App OnStart code:
    ClearCollect(
            colMenuItems,
            {screen: scrHome, screenName: "Home", icon: Icon.Home },
            {screen: scrReports, screenName: "Reports", icon: Icon.Document},
            {screen: scrMaps, screenName: "Maps", icon: Icon.Pin},
            {screen: scrContacts,screenName: "Contacts", icon: Icon.Person}
    )
  • Component (in app) cmpMenuItems property: colMenuItems

Are you able to tell why the menu must be clicked twice to "stick"?

 

componentMenu.gif

 

Dual Super User
Dual Super User

Re: COMPONENTS: Set Gallery Default based on screen?

Hi @seadude 

 

Can you try to modify few properties as:
Component Custom Property (cmpMenuItems) placeholder code:
Table({screen: App.ActiveScreen, screenName: "Home", icon: Icon.Home })
 
Component Gallery Default property:
LookUp(Component1.CustomProperty1,screen = App.ActiveScreen)
 
Component Gallery Icon OnSelect property:
Navigate(LookUp(Component1.CustomProperty1,screenName = ThisItem.screenName).screen)
 
I carried out a test on my side and using below properties the component was working fine. There was no need for selecting the icon twice.
 
Hope this Helps!
 
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted
Super User
Super User

Re: COMPONENTS: Set Gallery Default based on screen?

Hi @yashag2255 ,

 

Thank you VERY much for the assistance. You taught me a few very insightful things! And your solution worked. There is still some strange behaviour (a double-clicking- type thing happening, but its not a showstopper).

menuDoubleClick.gif

 

Thanks again!

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,735)