SelectedItem: PP.TabItem
The SelectedItem property sets which of the tabs is selected.
Only one tab can be selected in the component at the same time. Selecting a tab means opening its contents.
The first tab is selected by default.
The user can also select a tab using the SelectedIndex property.
To execute the example, connect the PP.js components library and the PP.css visual styles table. Create the TabControl component.
<script type="text/javascript">
//Create the TabControl component:
var tabcontrol = new PP.Ui.TabControl({
//ID for the tag div
ParentNode: document.getElementById("tabcont1"),
Width: 250,
Height: 50,
//Path to the folder that stores images:
ImagePath: "img"
});
//Add tabs to the TabControl component:
tabcontrol.addItem(new PP.Ui.TabItem({Position: PP.LTRB.Top, Caption: "First tab"}));
tabcontrol.addItem(new PP.Ui.TabItem({Position: PP.LTRB.Top, Caption: "Second tab"}));
//Set the second tab as selected:
tabcontrol.setSelectedItem(tabcontrol.getItems()[1]);
</script>
After executing the example a TabControl component that consists of two tabs is positioned on the HTML page. The second tab is selected.
See also: