Hi all.
I have a screen with 2 buttons and 1 Gallery as follow:
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.
Solved! Go to Solution.
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):
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.
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):
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.
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!!
User | Count |
---|---|
252 | |
125 | |
106 | |
50 | |
49 |