CSBL - widgetOnOffButton (IN/OUT)

 

 

widgetOnOffButton as Writing widget

First of all, an existing widget must be identified in the dashboard to be the target of the triggedered action, of which the id <TARGET_WIDGET_NAME> must be noted. In this example the target is a WidgetSingleContent.
The JS function to be inserted in the appropriate CK Editor box (in more options) of the current OnOffButton widget is of the following type:

 

function execute() {

$('body').trigger({

        type: "showSingleContentFromExternalContent_<TARGET_WIDGET_NAME>",

        eventGenerator: $(this),

        targetWidget: "<TARGET_WIDGET_NAME>",

        color1: "#e8a023",

        color2: "#9c6b17",

        widgetTitle: "ShowDouble", 

passedData: { "dataOperation": param}

    });

}

 

The passedData field can be:

               passedData: {

"dataOperation": <VALUE>

}

 

The param variable consists of the input value generated by the state change of the widgetOnOffButton widget. you can send it in passedData, or use it to perform operations in javascript:

 

function execute() {

var check_status='NOT ACTIVED';

if (param !== null){

check_status = 'ACTIVED';

}

$('body').trigger({

       type: "showSingleContentFromExternalContent_<TARGET_WIDGET_NAME>",

       eventGenerator: $(this),

       targetWidget: "<TARGET_WIDGET_NAME>",

       color1: "#e8a023",

       color2: "#9c6b17",

       widgetTitle: "ShowOnOffStatus", 

passedData: { "dataOperation": check_status}

    });

}

In this example in the <TARGET_WIDGET_NAME> a string "ACTIVED" or "NOT ACTIVED" will appear if the status of the widget widgetOnOffButton is null or not, for this reason before the function $('body').trigger a variable check_status is created and a check on the content of the param, which corresponds to the current state of the widget, and then send it in the PassedData.

 

widgetOnOffButton as Reading widget

It is possible to send a status value from another widget as a read parameter in the widget on/off button using a js function inserted in the CKEditor of the writing widget.

In this example, you can send a parameter from an impulse button widget to an on/off button widget. In the CKEditor of the writing widget this execute function must be written whose type must be written as follows. showOnOffButtonFromExternalContent_<TARGET_WIDGET_NAME>

function execute() {   

$('body').trigger({

    type: "showOnOffButtonFromExternalContent_<TARGET_WIDGET_NAME>",

    eventGenerator: $(this),

    targetWidget: "<TARGET_WIDGET_NAME>",

    widgetTitle: "ShowData", 

    passedData: { "dataOperation": <VALUE>}

    });

}

The <VALUE> must be setted as “Off” or “On”.