TabSheetObjectSelection.select

Syntax

select(object: PP.Ui.TabSheetObject, saveCurrentSelections: Boolean);

Parameters

object. Table object to be selected.

saveCurrentSelections. Indication of additional selection (if this parameter is True, new selection is added to the existing one, if the parameter is False, previous selection is reset).

Description

The select method selects a specified object in the table.

Example

To execute the example, the HTML page must contain the TabSheet component named tabSheet (see Example of Creating the TabSheet Component), and the cell under coordinates (1, 1) must contain an icon as an object of the PP.Ui.TabSheetObject type named tabSheetObject (see the page with description of the TabSheet.addObject method). Select this icon, get width of its border, coordinates of its top left and bottom right corner, and then add a button that will remove object selection:

// Get table object
var object = tabSheet.getModel().getObjects()[0];
// Get object selection in table
var objSelection = tabSheet.getObjectSelection();
// Select object
objSelection.select(object, True);
// Get active selected object
var activeObject = objSelection.getActiveObject();
// Output width of selected object border
console.log("Selected object border width: " + objSelection.getSelectionBorderWidth());
// Get offset for the top left object corner
var topLeftOffset = objSelection.getTopLeftOffset();
console.log("Offset for the top left object corner:");
console.log("Left: " + topLeftOffset.left + ", Top: " + topLeftOffset.top);
// Get offset for the bottom right object corner
var bottomRightOffset = objSelection.getBottomRightOffset();
console.log("Offset for the bottom right object corner:");
console.log("Left: " + bottomRightOffset.left + ", Top: " + bottomRightOffset.top);
// Add a button that clears selection
var clearButton = new PP.Ui.Button({
    ParentNode: document.body,
    Id: "clearButton",
    ResourceKey: "clearButton",
    Content: "Deselect object",
    Click: function btnOnClick() {
        objSelection.clear();
    }
});

After executing the example an icon is selected in the table, and a button to remove this selection is added to the page:

The browser console shows width of icon border and coordinates of icon's top left and bottom right corners:

Width of selected object border: 1
Offset for the object's top left corner:
Left: 138, top: 72
Offset for the object's bottom right corner:
Left: 170, top: 104
 

After clicking the Deselect Object button, icon selection is cleared:

See also:

TabSheetObjectSelection