<!DOCTYPE HTML>
<html>

<head>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta http-equiv='Content-Type' content='text/html;charset=UTF-8' />

  <script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" 
  id="sap-ui-bootstrap" 
  data-sap-ui-libs="sap.m"
  data-sap-ui-resourceroots='{"view": "./"}' 
  data-sap-ui-theme="sap_bluecrystal" data-sap-ui-xx-bindingSyntax="complex">
  </script>
  <!-- only load the mobile lib "sap.m" and the "sap_bluecrystal" theme -->

  <!-- by Denise Nepraunig @denisenepraunig -->
  
  <!-- example for a SAPUI5 MVC XML view with JSON data from a file
       and data binding based on the demokit example from sapui5:
       https://sapui5.netweaver.ondemand.com/sdk/explored.html#/entity/sap.m.Table/samples
       -->

  <script>
    // Best practice would be to set this stuff up in an Component.js
    // but let's not over-complicate stuff for demonstration purposes
    
     // http://scn.sap.com/community/developer-center/front-end/blog/2014/12/10/sap-ui5-with-local-json-model
    

    //sap.ui.localResources("view");
	  
		var app = new sap.m.App({initialPage:"idApp1"});  
		var view = sap.ui.view({id:"idApp1",
		type:sap.ui.core.mvc.ViewType.JS,
		viewName:"view.Main"});
		
    app.addPage(view);  
    app.placeAt("content");  
  </script>

</head>

<body class="sapUiBody" role="application">
  <div id="content"></div>
</body>

</html>
// Code goes here

/* Styles go here */

sap.ui.jsview("view.Main", {

	/** 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 list.page
	*/ 
	getControllerName : function() {
		return "view.Main";
	},

	/** 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 list.page
	*/ 
	createContent : function(oController) {
 		return new sap.m.Page({
			title: "Title",
			content: [
			 new sap.m.MultiComboBox("mc",{ 
	                          id: "cmbCoEmSelMonth",
	                          allowMultiSelect : true,
	                          width:"200px",
	                          placeholder : 'SUBMETER',
	                          selectionChange:[oController,oController.multi],
	                                                
	                          items: [
	new sap.ui.core.ListItem({text: "1002 : 161363 - Eau glacée 30m3", key: "1002"}),
	new sap.ui.core.ListItem({text: "1003 : EM535 - Chaudière", key: "1003"}),
	new sap.ui.core.ListItem({text: "1004 : 5776 - GLATT", key: "1004"}),
	new sap.ui.core.ListItem({text: "1005 : 12M02 - Fermenteur 100m3", key: "1005"}),
	new sap.ui.core.ListItem({text: "1006 : ER005 - Eau de refroidissement", key: "1006"}),
	new sap.ui.core.ListItem({text: "1007 : TCP MF-UF", key: "1007"}),
	new sap.ui.core.ListItem({text: "1008 : Soutirage Enzymes", key: "1008"}),
	new sap.ui.core.ListItem({text: "1009 : Chromato", key: "1009"}),
	new sap.ui.core.ListItem({text: "1010 : Compresseur HP GA50VSD (50 kW)", key: "1010"}),
	new sap.ui.core.ListItem({text: "1011 : Compresseur HP GA37+  (41,3 kW)", key: "1011"}),
	new sap.ui.core.ListItem({text: "1012 : Pilote LP1", key: "1012"}),
	new sap.ui.core.ListItem({text: "1013 : TPBT02 - Bâtiment Administratif", key: "1013"}),
	new sap.ui.core.ListItem({text: "1014 : 122100 eau glacée 100m³", key: "1014"}),
	new sap.ui.core.ListItem({text: "1015 : 12M02 - Fermenteur 100m3", key: "1015"}),
	new sap.ui.core.ListItem({text: "1016 : AC002 - TD air comprimé HP-BP", key: "1016"}),
	new sap.ui.core.ListItem({text: "1017 : CA1020 - Fermenteur 36m3", key: "1017"}),
	new sap.ui.core.ListItem({text: "1018 : NOVASEP", key: "1018"}),
	new sap.ui.core.ListItem({text: "1019 : Filtration Rhodia", key: "1019"}),
	new sap.ui.core.ListItem({text: "1020 : MCC0030 - Acide tartrique", key: "1020"}),
	new sap.ui.core.ListItem({text: "1021 : MCC-0010 Ligne 100m3", key: "1021"}),
	new sap.ui.core.ListItem({text: "1022 : Westfalia Séparator", key: "1022"}),
	new sap.ui.core.ListItem({text: "1023 : 93351 Mélange Guerin Systems", key: "1023"}),
	new sap.ui.core.ListItem({text: "1024 : Sèchage aéromatic GEA", key: "1024"}),
	new sap.ui.core.ListItem({text: "1025 : Départ pour compresseur BP ZE4VSD (315 kW)", key: "1025"}),
	new sap.ui.core.ListItem({text: "1026 : Départ pour compresseur BP ZE4(1) (315 kW)", key: "1026"}),
	new sap.ui.core.ListItem({text: "1027 : Départ pour compresseur BP ZE4(2) (315 kW)", key: "1027"}),
	new sap.ui.core.ListItem({text: "1028 : 122100 eau glacée 100m3", key: "1028"}),
	new sap.ui.core.ListItem({text: "1029 : TPBT01 - Usine 36 m3", key: "1029"})
	 
	 
	                                                        ]
	                                                      	  
			          })
			]
		});
	}

});
sap.ui.controller("view.Main", {

/**
* 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 bars.page
*/
//	onInit: function() {
//
//	},
multi:function(evt){
	var sel = evt.oSource.getSelectedKeys();
	alert(sel);
	console.log(sel);
}
/**
* 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 bars.page
*/
//	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 bars.page
*/
//	onAfterRendering: function() {
//
//	},

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

});