invertSelection();
The invertSelection method inverts selection of container elements.
The method selects not selected elements and deselects elements that were selected.
To execute the example, the HTML page must contain MetabaseObjectsIconView component named list1 (see Example of Creating the MetabaseObjectsIconView Component). In the BODY tag add div elements with the div1, div2, div3 identifiers.
Add the but1, but2 and but3 buttons to the page, process button click events:
// Button selects all container elements var but1 = new PP.Ui.Button({ ParentNode: document.getElementById("div1"), Content: "Select all" }) but1.Click.add(function (sender, args) { list1.selectAll(); }) // Button deselects all container elements var but2 = new PP.Ui.Button({ ParentNode: document.getElementById("div2"), Content: "Deselect all" }) but2.Click.add(function (sender, args) { list1.deSelectAll() }) // Button inverts selection var but3 = new PP.Ui.Button({ ParentNode: document.getElementById("div3"), Content: "Invert selection" }) but3.Click.add(function (sender, args) { list1.invertSelection() })
After executing the example the following buttons are placed:
Select all. Clicking the button selects all container elements.
Deselect all. Clicking the button deselects all container elements.
Invert selection. Clicking the button inverts selection.
See also: