CONTROLLER_OBJECT
Structure of the controllers of the script.
Summary
Variables | |
---|---|
disabled | {Boolean} true if the controller is disabled. |
hidden | {Boolean} true if the controller is hidden. |
Functions | |
---|---|
clearHelper | Hide the small icon. |
controller.watch | Watches input elements on the loaded web page. |
maximizeOpBrowser | Opens Browser control in full screen mode. |
rebuild | Rebuild the structure of the controller. |
refresh | Refresh the controller based on the selected values of the fields belonging to it. |
showHelper | Show a small icon beside the controller. |
disabled
{Boolean} true if the controller is disabled.
VARIABLES
hidden
{Boolean} true if the controller is hidden.
FUNCTIONS
clearHelper
Hide the small icon.
Parameters
none
Returns
none
Example
see showHelper
maximizeOpBrowser
Opens Browser control in full screen mode. Only available for Browser control.
Parameters
none
Returns
none
Example
$('page1').onLoad = function() {
vcc.getController('browser').maximizeOpBrowser();
});
};
refresh
Refresh the controller based on the selected values of the fields belonging to it. (Important: it only refreshes the selection/value of the controller, not the selectable values.)
Parameters
none
Returns
none
Example
We have the original data in a text field, but we don’t want them to be changed. We have a field for the actual data, and for the simplicity we would like to copy the original data to the actual field and controller by clicking on a button.
$('page', 'my_button').afterSetData = function() {
// copy the value to the new field (it is stored in the database)
vcc.setFieldValue('actual', vcc.getFieldValue('original'));
// refresh the controller to load the the value from the database
vcc.getController('page', 'actual').refresh();
};
rebuild
Rebuild the structure of the controller. You need to use it if you want to update the available values.
Parameters
none
Returns
none
Example
After updating the manufacturer field we want to filter the mobile phones according to the selected manufacturer. You can find the remaining code in the documentation of the EVENTS.onLoadData> event.
$('page', 'manufacturer').afterSetData = function() {
vcc.getController('page', 'mobile_phones').rebuild();
};
refresh
Refresh the controller based on the selected values of the fields belonging to it. (Important: it only refreshes the selection/value of the controller, not the selectable values.)
Parameters
none
Returns
none
Example
We have the original data in a text field, but we don’t want them to be changed. We have a field for the actual data, and for the simplicity we would like to copy the original data to the actual field and controller by clicking on a button.
$('page', 'my_button').afterSetData = function() {
// copy the value to the new field (it is stored in the database)
vcc.setFieldValue('actual', vcc.getFieldValue('original'));
// refresh the controller to load the the value from the database
vcc.getController('page', 'actual').refresh();
};
showHelper
Show a small icon beside the controller. It can be used for errors, warning, or just an information.
Parameters
Name | Type |
---|---|
mode | {vcc.CONTROLLER_HELPERS} the mode of the helper |
label | {String} the main text of the helper |
[title] | {String} the title of the helper |
Example
We want to warn the agent if the amount of the salary is bigger than 2000.
$('page', 'salary').afterSetData = function(data) {
if (data > 2000) {
vcc.getController('page', 'salary').showHelper(vcc.CONTROLLER_WARNING,
'The salary can be mistyped');
} else {
vcc.getController('page', 'salary').clearHelper();
}
};
Comments
Can’t find what you need? Use the comment section below to connect with others, get answers from our experts, or share your ideas with us.
There are no comments yet.