<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
	<meta charset="UTF-8">
	<title>SplitApp IconTabBar</title>
	<script
		id="sap-ui-bootstrap"
		src='https://sapui5.hana.ondemand.com/resources/sap-ui-core.js'
		data-sap-ui-theme="sap_bluecrystal"
    data-sap-ui-libs="sap.m"
    data-sap-ui-xx-bindingSyntax="complex"
		data-sap-ui-resourceroots='{
				"sap.ui.demo.split": "./"
			}'>
	</script>
	<style>
	  .labelStyle{
	    font-size:0.975rem;
	    margin-top:12%;
	  }
	  .inputStyle{
	    margin-left:6%;
	  }
	  .flexStyle{
	        margin-left: 2%;
    }
	</style>
	<script>
				new sap.m.Shell("ShellId",{title: "SplitApp IconTabBar",
					showLogout: false,
					app: new sap.ui.core.ComponentContainer({
						name: "sap.ui.demo.split"		
					})
				}).placeAt("content");
	</script>
</head>
<body class="sapUiBody" id="content">
</body>
</html>
// Code goes here

/* Styles go here */

jQuery.sap.declare("sap.ui.demo.split.Component");  
sap.ui.core.UIComponent.extend("sap.ui.demo.split.Component", {  
   createContent : function () {  
  // create root view  
	  var oView = sap.ui.view({  
		  id : "app",  
		  viewName : "sap.ui.demo.split.SplitHome",  
		  type : "JS",  
	  });  
	  
var myData= [{id:"1",name:"Attachment"},  
  {id:"2",name:"Notes"},  
  {id:"3",name:"People"}];
	
	var model = new sap.ui.model.json.JSONModel();
		model.setData({
			modelData: {
			userData : []
			}
			});
		oView.setModel(model);
		oView.getModel().setProperty("/modelData/Data", myData); 
       
return oView;  
  }  
});  
sap.ui.jsview("sap.ui.demo.split.SplitHome", {  
  /** Specifies the Controller belonging to this View. 
  * In the case that it is not implemented, or that "null" is returned, this View does not have a Controller. 
  * @memberOf routingdemo.App 
  */  
  getControllerName : function() {  
  return "sap.ui.demo.split.SplitHome";  
  },  
  /** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed. 
  * Since the Controller is given to this method, its event handlers can be attached right away. 
  * @memberOf routingdemo.App 
  */  
  createContent : function(oController) {  
  this.setDisplayBlock(true);  
	this.app = new sap.m.App("mainApp",{initialPage:"SplitPage"});

		var page = sap.ui.jsview("SplitPage", "sap.ui.demo.split.SplitPage");
		this.app.addPage(page);
  return this.app;  
  }  
});
sap.ui.controller("sap.ui.demo.split.SplitHome", {

/**
* Called when a controller is instantiated and its View controls (if available) are already created.
* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
* @memberOf zui5_sample.Home
*/
//	onInit: function() {
//
//	},

/**
* Similar to onAfterRendering, but this hook is invoked before the controller's View is re-rendered
* (NOT before the first rendering! onInit() is used for that one!).
* @memberOf zui5_sample.Home
*/
//	onBeforeRendering: function() {
//
//	},

/**
* Called when the View has been rendered (so its HTML is part of the document). Post-rendering manipulations of the HTML could be done here.
* This hook is the same one that SAPUI5 controls get after being rendered.
* @memberOf zui5_sample.Home
*/
//	onAfterRendering: function() {
//
//	},

/**
* Called when the Controller is destroyed. Use this one to free resources and finalize activities.
* @memberOf zui5_sample.Home
*/
//	onExit: function() {
//
//	}

});
sap.ui.jsview("sap.ui.demo.split.SplitPage", {  
  /** Specifies the Controller belonging to this View. 
  * In the case that it is not implemented, or that "null" is returned, this View does not have a Controller. 
  * @memberOf routingdemo.App 
  */  
  getControllerName : function() {  
  return "sap.ui.demo.split.SplitPage";  
  },  
  /** Is initially called once after the Controller has been instantiated. It is the place where the UI is constructed. 
  * Since the Controller is given to this method, its event handlers can be attached right away. 
  * @memberOf routingdemo.App 
  */  
  createContent : function(oController) {  
  var controller = this.oController;
	
	var oList = new sap.m.List({mode : sap.m.ListMode.SingleSelectMaster
		,showSeparators : sap.m.ListSeparators.All
		,swipeDirection : sap.m.SwipeDirection.Both
		,rememberSelections : false
		,selectionChange : function(oEvent){
		  controller.onPress(oEvent);
		}});

	var oTemplate = new sap.m.StandardListItem({
		title : "{name}"
				,type : sap.m.ListType.Navigation
	});

	var oSorter = new sap.ui.model.Sorter("Product", false, false);
	oList.bindItems("/modelData/Data",oTemplate,oSorter);
	
	var oSplitApp = new sap.m.SplitApp("oSplitApp",{mode:"PopoverMode"});
	
	var oPage1 = new sap.m.Page({title:"Master",content:[oList]});
	
	var oPage2 = new sap.m.Page({title:"Detail"});
	var oTabBar = new sap.m.IconTabBar({id:"oTab",
						items:[new sap.m.IconTabFilter({text:"Attachment", key:"Attachment", icon:"sap-icon://attachment",content:[new sap.m.Text({text:"Attachment Goes Here..."})]}),
						new sap.m.IconTabFilter({text:"Notes", key:"Notes", icon:"sap-icon://notes",content:[new sap.m.Text({text:"Notes go here ..."})]}),
						new sap.m.IconTabFilter({text:"People",key:"People", icon:"sap-icon://group", content:[new sap.m.Text({text:"People go here ..."})]})]
	});
	oPage2.addContent(oTabBar);
	
	oSplitApp.addMasterPage(oPage1);
	oSplitApp.addDetailPage(oPage2);
	
	return oSplitApp;
  }  
});
sap.ui.controller("sap.ui.demo.split.SplitPage", {

/**
* Called when a controller is instantiated and its View controls (if available) are already created.
* Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization.
* @memberOf table_v01.Main
*/

	onInit: function() {
  var oTab = sap.ui.getCore().byId("oTab");
 // oTab.getItems();
	},
	
	onPress: function(oEvent){
	var oSelectedText = oEvent.getParameter("listItem").getTitle();
  var oTab = sap.ui.getCore().byId("oTab");
  oTab.setSelectedKey(oSelectedText);
	}

});