ControlBarView.add

Syntax

add (prxControl: PP.Prx.Control, toNode: Boolean))

Parameters

prxControl. Control to be added to the panel.

toNode. Determines whether to add control to DOM node: True - add, False - do not add.

Description

The add method adds control to the panel.

Example

To execute this example, the HTML page must contain the ReportBox component named reportBox (see Example of the ReportBox Component Layout). The source regular report must contain one or more controls.. The first control must be an instance of the PP.Prx.Ui.DimComboControlView class. Remove all controls from the panel, and next add a control that corresponds to the first control in the report:

        ctrl = PP.Prx.Ui.PrxControl.create({
            Source: prxReport.getControls()[0],
            Report: reportBox.getSource(),
            Service: prxMbService
        });
        ctrl.MetadataChanged.add(function (sender, args) {
            console.log(args.Args._Metadata.dimMeta.data.selection.selectedCount)
        });
        ctrl.setName("New control");
        ctrl.getLabel().setEnabled(false);
         controlBar = reportBox.getDataView().getControlBar();
        controlBar.clear(true);
        controlBar.add(ctrl, true);

After executing the example the control bar of the regular report is cleared, and a control corresponding to the first control in the report is added to it. The new control will be named New Control, the label will be inactive:

 On changing selection in the control the console will show the number of selected controls.

See also:

ControlBarView