new RMP_Button(conf)
This constructor allows you to create a button widget that can be inserted dynamically in your web interface.
Parameters:
Name | Type | Description |
---|---|---|
conf |
Object | JSON structure which contains the configuration of the button |
Example
var btnConf = {
id: 'id_insertedButton',
label: 'Inserted button',
action: 'execute_script'
};
var btn = new RMP_Button(btnConf);
id_of_a_widget.insertAbove(btn) // id_of_a_widget is the ID of a widget that already exists in the WI.
id_insertedButton.setExecuteScript(() => {console.log('inserted button')})
Methods
# inner getMessage() → {string}
Returns the message displayed to the connected user when the
button is clicked.
string
# inner getOnClickAction() → {string}
Returns the "On click" action (show-message, close, redirect, load-next).
string
# inner getRedirectUrl() → {string}
Returns the redirect URL if the "On click" type is "redirect".
string
# inner setExecuteScript(callBk)
Sets a callback function for a button widget's
'execute_script' action.
Parameters:
Name | Type | Description |
---|---|---|
callBk |
buttonCallback | Callback to execute after the button has been clicked |
# inner setMessage(msg)
Sets the message displayed to the connected user when the
button is clicked.
Parameters:
Name | Type | Description |
---|---|---|
msg |
string | Message value |
# inner setOnClickAction(action)
Sets the "On click" action.
Parameters:
Name | Type | Description |
---|---|---|
action |
string | "On click" action: show-message, close, redirect, load-next |
# inner setOnPrelaunchScript(callBk)
Sets a callback function to handle the pre-launch script
of a button widget.
Note: A pre-launch script has no effect for Execute Script buttons.
Note: A pre-launch script has no effect for Execute Script buttons.
Parameters:
Name | Type | Description |
---|---|---|
callBk |
buttonCallback | Callback that handles the pre-launch script |
# inner setRedirectUrl(url)
Sets the redirect URL if the "On click" type is "redirect".
Parameters:
Name | Type | Description |
---|---|---|
url |
string | Redirect URL |