sapui5 - Data not visible in second view ui5 -


i facing 1 issue view data not visible in project. have created application first view 'input.view.xml' , second view 'plant.view.xml'. in first view have button "material details" , on clicking moves second view coming blank. json file having data it's not coming in second view.

can please suggest issue , how fix it. please find attached code snippet below.

plant.view.xml(second view)

<mvc:view    controllername="stock.controller.plant"    xmlns="sap.m"    xmlns:viz="sap.viz.ui5.controls"    xmlns:l="sap.ui.layout"    xmlns:mvc="sap.ui.core.mvc">    <messagepage       shownavbutton="true"       navbuttonpress="onnavback"/>      <table id="idproductstable"         inset="false"         items="{             path: '/productcollection',             sorter: {                 path: 'name'             }         }">         <headertoolbar>             <toolbar>                 <title text="products" level="h2"/>             </toolbar>         </headertoolbar>         <columns>             <column                 width="12em">                 <text text="product" />             </column>             <column                 minscreenwidth="tablet"                 demandpopin="true">                 <text text="supplier" />             </column>             <column                 minscreenwidth="tablet"                 demandpopin="true"                 halign="end">                 <text text="dimensions" />             </column>             <column                 minscreenwidth="tablet"                 demandpopin="true"                 halign="center">                 <text text="weight" />             </column>             <column                 halign="end">                 <text text="price" />             </column>         </columns>         <items>             <columnlistitem>                 <cells>                     <objectidentifier                         title="{name}"                         text="{productid}"/>                     <text                         text="{suppliername}" />                     <text                         text="{width} x {depth} x {height} {dimunit}" />                     <objectnumber                         number="{weightmeasure}"                         unit="{weightunit}"                         state="{                             parts: [                                 {path: 'weightmeasure'},                                 {path: 'weightunit'}                             ],                             formatter: 'stock.formatter.weightstate'                         }" />                     <objectnumber                             number="{                                 parts:[{path:'price'},{path:'currencycode'}],                                 type: 'sap.ui.model.type.currency',                                 formatoptions: {showmeasure: false}                             }"                             unit="{currencycode}" />                 </cells>             </columnlistitem>         </items>     </table>           </mvc:view> 

**plant.controller.js**    sap.ui.define([  	'sap/ui/core/mvc/controller',  	'jquery.sap.global',  	'stock/formatter',  	'sap/ui/core/routing/history',  	'sap/ui/model/json/jsonmodel'  ], function (controller, jquery, formatter, history,jsonmodel) {  	"use strict";  	var tablecontroller =  controller.extend("stock.controller.plant", {  		  		oninit: function () {  			// set explored app's demo model on sample  			var omodel = new jsonmodel(jquery.sap.getmodulepath("sap.ui.demo.mock", "/products.json"));  			this.getview().setmodel(omodel);  		},  		  		getrouter : function () {  			return sap.ui.core.uicomponent.getrouterfor(this);  		},  		  		  		onnavback: function () {  			var ohistory, sprevioushash;  			ohistory = history.getinstance();  			sprevioushash = ohistory.getprevioushash();  			if (sprevioushash !== undefined) {  				window.history.go(-1);  			} else {  				this.getrouter().navto("input", {}, true);  			}  		}  	});  	return tablecontroller;  });

component.js

sap.ui.define(["sap/ui/core/uicomponent",     "sap/ui/core/mvc/xmlview",     "sap/ui/model/json/jsonmodel"],     function(uicomponent,jsonmodel,xmlview) {     "use strict";      var component = uicomponent.extend("stock.component", {          metadata : {         manifest: "json",             gettable : function () {                 return this._rootview.getcontent()[0];             }                 },                 publicmethods : [                     "gettable"                 ],                 dependencies : {                     libs : [                         "sap.m",                         "sap.ui.layout"                     ]                 },              rootview : "stock.view.input",             config : {                 sample : {                     files : [                         "view.input.view.xml",                         "controller.main.controller.js",                         "formatter.js"                         // "dialog.fragment.xml"                     ],                     description : "in example assisted input provided table-like suggestions several columns can display more details."                 }             },      init : function () {         // call init function of parent         uicomponent.prototype.init.apply(this, arguments);         this.getrouter().initialize();     }     });      component.prototype.createcontent = function () {         this._rootview = sap.ui.xmlview({ viewname : "stock.view.input" });         return this._rootview;     };      return component; }); 

 	**"input view" (first view)**        <mvc:view  		controllername="stock.controller.main"  		xmlns:l="sap.ui.layout"  		xmlns:mvc="sap.ui.core.mvc"  		xmlns:viz="sap.viz.ui5.controls"  		xmlns="sap.m">  		<app id="app">  	<l:verticallayout  		class="sapuicontentpadding"  		width="100%" height="100%">  		<l:content>  			<label text="product" labelfor="productinput"/>  			<input  				id="productinput"  				type="text"  				placeholder="enter material ..."  				showsuggestion="true"  				showtablesuggestionvaluehelp="false"  				suggestionrows="{/productcollection}"  				suggestionitemselected="onselectitem">  				<suggestioncolumns>  					<column  						halign="begin"  						popindisplay="inline"  						demandpopin="true">  						<label text="name"/>  					</column>  					  					<!-- <column  						halign="center"  						popindisplay="inline"  						demandpopin="true"  						minscreenwidth="tablet">  						<label text="product id"/>  					</column>  					<column  						halign="center"  						popindisplay="inline"  						demandpopin="false"  						minscreenwidth="tablet">  						<label text="supplier name"/>  					</column>  					<column  						halign="end"  						popindisplay="inline"  						demandpopin="true">  						<label text="price"/>  					</column> -->  					  					  				</suggestioncolumns>  				<suggestionrows>  					<columnlistitem>  					<cells>  						<label text="{productid} {name}" id="inputkey"/>  						  <!-- 						<label text="{productid}"/> -->  <!-- 						<label text="{suppliername}"/> -->  <!-- 						<label -->  <!-- 							text="{ -->  <!--  		 						parts:[{path:'price'},{path:'currencycode'}], -->  <!-- 								type: 'sap.ui.model.type.currency', -->  <!-- 		 						formatoptions: {showmeasure: true} -->  <!-- 							}"/> -->      					</cells>  					</columnlistitem>  				</suggestionrows>  			</input>  		</l:content>  		 <l:content>           <button id="ondisplay" text="{i18n>materialdetails}" press="ondisplayplant" class="sapuitinymarginend"/>        </l:content>  	</l:verticallayout>  </app>  </mvc:view>

`

first view second view

regards, ajay


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -