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 the MetabaseObjectsListView component named list (see Example of Creating the MetabaseObjectsListView Component).
In the BODY tag add a div element with the div1, div2, div3 identifiers:
<body> <div id="div1"></div> <div id="div2"></div> <div id="div3"></div> </body>
Add the but1, but2 and but3 buttons to the page, process button click events:
// A button selects all container elements var but1 = new PP.Ui.Button({ ParentNode: document.getElementById("div1"), Content: "Select all" }) but1.Click.add(function (sender, args) { list.selectAll(); }) // A button deselects all container elements var but2 = new PP.Ui.Button({ ParentNode: document.getElementById("div2"), Content: "Deselect all" }) but2.Click.add(function (sender, args) { list.deSelectAll() }) // A button inverts selection var but3 = new PP.Ui.Button({ ParentNode: document.getElementById("div3"), Content: "Invert selection" }) but3.Click.add(function (sender, args) { list.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: