Hey,
is it possbile to Store an entire Callback in a Variable and then just replace the callback with the variable name?
Some components in my layout are reliant on an if clause. 1 group of users sees a specific button which is used in a callback, others dont. But that callback has more than the button input, and the callback should still work for those without a button. For this reason i want the callback ti be adaptable if the users has the button or not.
I hope some understand my problem!
Thx in advance
If the button callback is included in the callback’s Input
, it’s absence from the layout will not cause any problems. I have a similar scenario where I have admin functions that regular users shouldn’t see; i utilize the ctx.callback_context
variable at the start of the callback to determine if the admin user is logged in. You could use this variable to determine if the button is present. See https://dash.plot.ly/faqs for more info.
Are you sure about it absence not causing any problems? Ive tested it the callback isnt triggered anymore, when one of the Inputs is missing.
ah…sorry…i wasn’t as detailed as I should have been. The button needs to be present but in the layout but it’s visibility hidden based on your user rules. You can do this via the style
parameter.