I'm very new to PowerApps and I'd inherited an App which has an component at the bottom of a screen.
In this component are selectable icons but one of which should be only available to the Admins (via a Sharepoint List).
Within the component > Data > Items there is this code:
Table(
{
Name: "Home",
Icon: Icon.DetailList,
Page: Dashboard,
Visible:true
},
{
Name: "Bookings",
Icon: Icon.Person,
Page: MyAppts,
Visible:true
},
{
Name: "Book",
Icon: Icon.Add,
Page: NewBooking,
Visible:true
},
{
Name: "Manage",
Icon: Icon.ComputerDesktop,
Page: ManageDesks,
Visible: varAdmin
}
)
The bottom bit hides the icon but is still clickable - how do you disable that as well so it can't be selected?
@M_Ali_SZ365 and @timl I think I've got a workaround for this which looks to have worked
I've done this for that particular icon:
Name: "Manage",
Icon: Icon.ComputerDesktop,
Page: If(varAdmin,ManageDesks, Dashboard),
Visible: varAdmin
I appreciate the assistance from both of you which then gave me the light bulb moment!
Separate note: it shouldn't be like this there something is hidden it shouldn't be clickable! Anyway thanks again!
Can you locate the gallery control in your component and find the formula that contains the call to Navigate?
Once you do that, can you post the formula?
The ultimate solution is to modify this formula so that it conditionally checks the visible property and to not navigate if the value of the visible property is false.
@timl yes that is correct. I'm clicking on the 'empty' space where the icon would have been.
Hi @rockshah
Just to clarify my understanding of this, you have a menu component that displays 4 icons - Home, Bookings, Book, Manage. Is there a gallery control in the component that displays this?
What I don't quite understand is, if the component correctly hides the Manage icon, what exactly are you clicking on? Is it the empty space where the icon would have appeared?
Select the icon And go to the Advance property and search the DisplayMode And write this code
If(varAdmin, DisplayMode.Edit, DisplayMode.Disabled)
Fuel our success! 🚀 Give a thumbs up and click 'Solution Accepted' to supercharge our community. Your actions speak volumes!
Warm regards,
Muhammad Ali
@M_Ali_SZ365 I didn't see DefaultMode or DisplayMode as an option within the dropdown box in the top left area.
Anyway I've amended it as per your instructions but unfortunately that didn't work. It's still clickable even though icon is hidden.
Any ideas?
Try This
Table(
{
Name: "Home",
Icon: Icon.DetailList,
Page: Dashboard,
Visible: true,
DisplayMode: DisplayMode.Edit
},
{
Name: "Bookings",
Icon: Icon.Person,
Page: MyAppts,
Visible: true,
DisplayMode: DisplayMode.Edit
},
{
Name: "Book",
Icon: Icon.Add,
Page: NewBooking,
Visible: true,
DisplayMode: DisplayMode.Edit
},
{
Name: "Manage",
Icon: Icon.ComputerDesktop,
Page: ManageDesks,
Visible: varAdmin,
DisplayMode: If(varAdmin, DisplayMode.Edit, DisplayMode.Disabled)
}
)
Fuel our success! 🚀 Give a thumbs up and click 'Solution Accepted' to supercharge our community. Your actions speak volumes!
Warm regards,
Muhammad Ali
Hi @M_Ali_SZ365 thanks for your response. I've only been looking at PowerApps for a day so you might have to be patient with my questions.
Where is the DisplayMode property?
varAdmin has been set as boolean within OnStart
Hi @rockshah ,
To make the "Manage" icon not clickable and not visible for non-admins, set the Visible property to varAdmin and use the same variable to conditionally set the DisplayMode property:
If(varAdmin, DisplayMode.Edit, DisplayMode.View)
For the "Manage" item in your table, ensure that varAdmin is a boolean that is true only for admin users. If varAdmin is false, the icon will be neither visible nor clickable.
Fuel our success! 🚀 Give a thumbs up and click 'Solution Accepted' to supercharge our community. Your actions speak volumes!
Warm regards,
Muhammad Ali