Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 3576

Re: Page Navigation from Drop Down

$
0
0
<!DOCTYPE html><html><head><script src="/openui5-sdk-1.29.1/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-theme="sap_bluecrystal" data-sap-ui-libs="sap.m"></script>  <meta charset="utf-8">  <title>JS Bin</title>    <!-- XML-based view definitions -->    <script id="master" type="sapui5/xmlview">        <mvc:View controllerName="master.controller" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">            <Page    title="Work order List"    class="sapUiContentPadding"    showNavButton="false" >    <headerContent>      <Button icon="sap-icon://flag" text="Route" press="route" id="route"/>    </headerContent>    <subHeader>      <Toolbar>             <Select id="mySelect" items="{/Categories}" selectedKey="{myModel>/selectedKey}">   <core:Item text="{Description}" key="{CategoryID}"></core:Item>   </Select>   <Button id="myButton" press="myButtonPress" text="Product Details"></Button>              </Toolbar>    </subHeader>             <List    id="__list"    items="{/Products}"       headerText="Order_Details">    <items>      <ObjectListItem        title="{ProductName}"        type="Active"        press="onListItemPress"        number="{QuantityPerUnit}"        numberUnit="{Quantity}">        <firstStatus>          <ObjectStatus            text="{UnitPrice}"             />        </firstStatus>         </ObjectListItem>    </items>  </List>             </Page>        </mvc:View>    </script>  <script>     jQuery.sap.require("sap.m.MessageToast");    sap.ui.controller("master.controller", {      onInit: function () {    // var oModel = new sap.ui.model.odata.ODataModel(    var oSelect = this.byId('mySelect');     //create a jsonModel to bind the selectedKey property of Select control     var oJSModel = new sap.ui.model.json.JSONModel({});     this.getView().setModel(oJSModel,"myModel");     var serviceurl = "proxy/V2/Northwind/Northwind.svc";    var oModel = new sap.ui.model.odata.ODataModel(serviceurl,true);     this.getView().setModel(oModel);     //get the reference of Select control model binding     var oBinding = oSelect.getBinding("items");     //attach a binding change handler to append Select... item to select control items     oBinding.attachChange(function(){     var oItem = new sap.ui.core.Item({text:"Select Product"});     var oSelect = this.byId('mySelect');     oSelect.insertItem(oItem,0);     }, this);     },    
myButtonPress : function (oEvent) {     var oSelect = this.byId('mySelect');     var controlSelectedKey = oSelect.getSelectedKey();      this.byId("__list").getBinding("items").filter( new sap.ui.model.Filter("CategoryID", sap.ui.model.FilterOperator.EQ, controlSelectedKey ));           }    });    var oMaster = sap.ui.xmlview({        viewContent: jQuery('#master').html()    });    var oSplitApp = new sap.m.App();    oSplitApp.addPage(oMaster);    oSplitApp.placeAt('content');  </script>  </head><body id="content" class="sapUiBody"></body></html>

Viewing all articles
Browse latest Browse all 3576

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>