Advanced User Interface Controls and Components
Loads data from local or remote data source into TabStrip.
Param | Type | Details |
---|---|---|
data | Array | An array of tab objects from local or remote data source |
This method does not return a value.
You can use this method to load data on demand, updating the whole TabStrip in the process.
Supported in: v1.0.
In this example we are showing how to use loadData method to populate the TabStrip from remote data source. Data source in this case is a JSON file which contains a flat list of tab objects. Any existing tabs in TabStrip, will be automatically removed.
$(document).ready(function() {
// Create an instance of TabStrip widget
var $tab = $('#tabstrip').tabstrip({
expandDirection: 'right',
headerContentOrientation: 'vertical',
showExpandBox: false
});
// Use jQuery getJSON method to read the content of JSON file and then use loadData method to populate the TabStrip widget
$.getJSON("data.json", function(data){
$tab.tabstrip('loadData', data);
});
});
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/integralui.tabstrip.css" />
<link rel="stylesheet" href="css/themes/theme-blue.css" />
<script type="text/javascript" src="external/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="external/jquery.ui.core.min.js"></script>
<script type="text/javascript" src="external/jquery.ui.widget.min.js"></script>
<script type="text/javascript" src="js/jquery.integralui.widget.min.js"></script>
<script type="text/javascript" src="js/jquery.integralui.tabstrip.min.js"></script>
</head>
<body>
<div id="tabstrip" class="widget"></div>
</body>
</html>
.widget
{
width: 300px;
height: 300px;
}
[
{ "id": "1", "text": "Dairy" },
{ "id": "2", "text": "Fruits" },
{ "id": "3", "text": "Grains" },
{ "id": "4", "text": "Meat" },
{ "id": "5", "text": "Sweets" },
{ "id": "6", "text": "Vegetables" },
{ "id": "7", "text": "Water" }
]
A sample which demonstrates how to use local data to load the content in TabStrip.