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.
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

 

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 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();
     }
};

There are no comments yet.

Comment

Subscribe to our newsletter
or Contact us!
Please note that by subscribing to our newsletter, you agree to receive regular email messages from VCC Live about service related news and updates. By subscribing to our newsletter, you also agree that VCC Live will use your data in accordance with the applicable Privacy Policy until you unsubscribe from the newsletter.