How to retrieve info from a Custom Button in the action callback?
How to retrieve info from a Custom Button in the action callback?
spacewrench
Posts: 5Questions: 2Answers: 0
I have attached some custom buttons to a DataTable, following this example.
In my callback function, I would like to access other info that I can see (in the debugger) to be attached to the this
object. However, apart from text
and action
, I can't figure out the right syntax. In particular, in the button creation object, I added a name
field, and I'd like to access that. What's the Right Way to do it?
Thanks!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @spacewrench ,
This example here shows how you can set a class name on the button. Here is the full list of options.
Cheers,
Colin
Thanks, but I'm trying to retrieve the button name (or possibly other info) about the button from the action routine. The idea is that one action routine can coordinate responses to several related buttons, but the routine needs to know which button called it.
I can get the button display text, but embedding that in the code is fragile (what if the button display name changes when the UI is translated, for example?)
Here's an edited version of your example that shows what I'm trying to do.
Thanks again!
Hi @spacewrench ,
Ah, the third argument to the
action()
function contains the configuration details for the button click - see here. That contains the name, class, namespace, etc.Hope that does the trick,
Cheers,
Colin
That's perfect, thanks very much!