NavigatorBox.invertSelection

Syntax

invertSelection();

Description

The invertSelection method inverts selection in the list of objects: that is, it selects not selected elements and deselects elements that were selected.

Comments

This method is relevant only if the NavigatorBox.ObjectListMultiSelect property is set to True.

Example

To execute the example, the page must contain NavigatorBox component named navbox (see Example of Creating the NavigatorBox Component. Add the DIV element with the radiobuttons identifier in the BODY tag. Place three radio buttons and add a handler of the NavigatorBox.ObjectSelected event:

            function RadioGroup(group, text, onChange, state)//Add a function containing values of the RadioButton component properties:
            { 
                var radiobutton = new PP.Ui.RadioButton(
                {
                    ParentNode: document.getElementById("radiobuttons"),
                                    Checked: state, //Indicates if selection exists
                                    GroupName: group, //Group name
                                    Content: text, //Text to be placed next to a radio button
                                    CheckedChanged: onChange //A handler of the event of selection change in the group of radio buttons
                                
                });        
            }
            //Instances of the RadioButton component. Values of component properties are used as parameters.
            RadioGroup('group1', Select all', function ()
            {
                navbox.selectAll()
            }, True);
            RadioGroup('group1', 'Deselect', function ()
            {
                navbox.removeSelection()
            }, False);
            RadioGroup('group1', 'Invert selection', function ()
            {
                navbox.invertSelection()
            }, False);
            navbox.ObjectSelected.add(function (sender, args)
            {
                console.log("Elements in the folder with the key are selected" + navbox.getObjectsListRootKey())
            })

After executing the example three checkboxes are placed on the page. Checking the Select All checkbox selects all objects in the list. Checking the Deselect All checkbox removes selection from all object in the list. Choosing the Invert Selection checkbox inverts selection: that is, if all objects were selected, they are deselected, and vice versa. Performing any of these operations brings up the following message in the browser console: Elements in the folder <Key of the opened folder> are selected.

See also:

NavigatorBox