cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
_kikilalaaa
Helper V
Helper V

Gallery does not work - Does not navigate

Hi all.

 

I have a screen with 2 buttons and 1 Gallery as follow:

_kikilalaaa_0-1612830366252.png

FYI, I have set some variables when screen.onvisible:

 

 

 

UpdateContext({varVillage:"V1"});
UpdateContext({varBlock:"C"});
UpdateContext({varLevel:"L1"})

 

 

 

 

This means that by default the Village Address would be V1-C with level 1.

 

If button V1-C is selected, I would update the variable and make the user unable to click on the button again. So, my code for V1CButton.OnSelected is

 

 

 

UpdateContext({varVillage:"V1"});
UpdateContext({varBlock:"C"});
DisplayMode.Disabled

 

 

 

Then in my gallery.Items, I would display all available levels in V1-c. So in my gallery.items would be:

 

 

 

Distinct(Filter('Student Accommodation',And('Village Name2' =varVillage, 'Village Block' = varBlock)),Level1)

 

 

 

 

Let say, if level 2 is selected, I would update the varLevel as 2 and navigate to the next screen.

So, in my gallery.Onselect:

 

 

 

UpdateContext({varLevel:Text(LevelV1C.Selected.Result)});
//Navigate(Village1_Female_RoomList,ScreenTransition.Fade)

 

 

 

 

BUT,

 

When I test, the button works fine except that it can still be chosen even though I have selected it.

and my gallery does show all available levels, but nothing happens when I click on it.

when I test by inserting a label and display varLevel, it still shows L1 even when I click on L2. and of course, it does not navigate to the next screen. 

 

How do I solve this? I have checked the display mode for the gallery, it has been set to edit.

 

please help I am so lost.

1 ACCEPTED SOLUTION

Accepted Solutions
v-jefferni
Community Support
Community Support

Hi @_kikilalaaa ,

 

Would you like to disable the buttons once clicked and navigate to other screen with the selected level?

 

If so, for the first issue, you will need to set DisplayMode properties of the two buttons:

1\ Add a context variable OnSelect of one Button:

UpdateContext({varClickable:!varClickable})

 

2\ Set DisplayMode of this Button to:

If(varClickable,DisplayMode.Edit,DisplayMode.Disabled)

 

Once the button be clicked, display mode turns to DisplayMode.Disabled which means non-clickable.

 

For the second issue, which data source are you working on? Which column type are the ‘Village Name2’ and ‘Village Block’?

 

As per your description, assuming they are both text type columns, then please make sure you have set the OnSelect of controls “IN” the Gallery, by default they should be Select(Parent):

v-jefferni_0-1612861553710.png

 

If you have selected the correct controls, set OnSelect of them to:

Navigate(Village1_Female_RoomList,ScreenTransition.Fade, {varLevel:Text(ThisItem.Result)})

 

Please refer to below doc to learn more about Navigate function and context variables:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-navigate#overview

 

You can use the Set function to create global variables instead which is easier:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-set

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

3 REPLIES 3
v-jefferni
Community Support
Community Support

Hi @_kikilalaaa ,

 

Would you like to disable the buttons once clicked and navigate to other screen with the selected level?

 

If so, for the first issue, you will need to set DisplayMode properties of the two buttons:

1\ Add a context variable OnSelect of one Button:

UpdateContext({varClickable:!varClickable})

 

2\ Set DisplayMode of this Button to:

If(varClickable,DisplayMode.Edit,DisplayMode.Disabled)

 

Once the button be clicked, display mode turns to DisplayMode.Disabled which means non-clickable.

 

For the second issue, which data source are you working on? Which column type are the ‘Village Name2’ and ‘Village Block’?

 

As per your description, assuming they are both text type columns, then please make sure you have set the OnSelect of controls “IN” the Gallery, by default they should be Select(Parent):

v-jefferni_0-1612861553710.png

 

If you have selected the correct controls, set OnSelect of them to:

Navigate(Village1_Female_RoomList,ScreenTransition.Fade, {varLevel:Text(ThisItem.Result)})

 

Please refer to below doc to learn more about Navigate function and context variables:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-navigate#overview

 

You can use the Set function to create global variables instead which is easier:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-set

 

Hope this helps.

 

Best regards,

Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

v-jefferni
Community Support
Community Support

Hi @_kikilalaaa ,

 

Have you resolved the issue? 

If my post helps, then please consider Accept it as the solution to help the other members find it.


Best regards,
Community Support Team _ Jeffer Ni

Community Support Team _ Jeffer Ni

If this post helps, then please consider Accept it as the solution to help the other members find it.

Thanks for reminding! I tried your solution and it's working!!

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,751)