|
This macro allows you to change the current state of the action bar button through.
To use the button's, ajax event, we recommend using this macro together with sc_actionbar_clicked_state(); that makes it possible to recover the current state of the button.
Definition of Parameters
| Parameters |
Type |
Values |
Description |
button_name |
string |
The button name must be informed using double quotes or single quotes.
Example
In bold, you can see the example of how the parameter button_name must be informed:
sc_actionbar_state("ajax_btn", "sent");
|
This is a mandatory parameter.
You need inform the name of the button created on the action bar.
|
state_name |
string |
The state name must be informed using double quotes or single quotes.
Example
In bold, you can see the example of how the parameter state_name must be informed:
sc_actionbar_state("ajax_btn", "sent");
|
This is a mandatory parameter.
You need inform the name of the next state that the button will assume.
|
Examples
Example - Changing the ajax_btn button state between pending and sent in the button's onclick event.
if (sc_actionbar_clicked_state() == 'pending') {
sc_actionbar_state('ajax_btn', 'sent');
} else {
sc_actionbar_state('ajax_btn', 'pending');
}
Example - Changing the state of the ajax_btn button between pending and sent, and storing the change in the base in the email_sent field.
if (sc_actionbar_clicked_state() == 'pending') {
$update = "update orders set email_sent = 'S' WHERE orderid =". {orderid}; sc_exec_sql($update);
sc_actionbar_state('ajax_btn', 'sent');
} else {
$update = "update orders set email_sent = 'N' WHERE orderid =". {orderid}; sc_exec_sql($update);
sc_actionbar_state('ajax_btn', 'pending');
}
Example - Display of the state of the ajax_btn button according to the value stored in the email_sent ield in the onRecord event of the Grid application.
if ({email_sent} == 'S') {
sc_actionbar_state('ajax_btn', 'sent');
} else {
sc_actionbar_state('ajax_btn', 'pending');
}
|