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

when i using router , How can i bind data in xml view

$
0
0

Hey guys I had no problem to bind data without using the route.

However, after using route, i have problem to bind data.

 

AP document controller.js

 

var sServiceUrl = "proxy/http/myurl/sap/opu/odata/SAP/YPLAS_TEST_SRV";

var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl,true);

var oJsonModel = new sap.ui.model.json.JSONModel();

 

oModel.read("DOC_CONDITIONSet?$filter=BUKRS eq '5100' and USRID eq '03101188' and UTYPE eq '33' and LIFNR eq '"+cs+"' and BSTAT eq '"+key+"' and REQFROMDATE eq '"+dateFrom+"' and REQTODATE eq '"+dateTo+"'&$expand=DOC_CRE_LISTSet",null,null,true,

  function(oData,response){

 

  oJsonModel.setData(oData);

  var message = response.headers;

  var json = message["sap-message"];

  if(json != null)

  sap.m.MessageToast.show(json, {width: "30em"});

 

  });

 

  sap.ui.getCore().setModel(oJsonModel, "ask");



APdocument xml.View

 

<t:Table id="supplieTable" rows="{ask>/results/0/DOC_CRE_LISTSet/results}"

  enableBusyIndicator="true" enableSelectAll="false" navigationMode="Paginator"

  visibleRowCount="6" >

 

 

  <t:columns>

  <t:Column autoResizeable="true">

  <Label text="Doc.number" />

  <t:template>

  <c:TextView text="{ask>BELNR}" />

  </t:template>

  </t:Column>

 

 

  <t:Column autoResizeable="true">

  <Label text="Vendor" />

  <t:template>

  <c:TextView text="{ask>NAME1}" />

  </t:template>

  </t:Column>

 

 

  <t:Column autoResizeable="true">

  <Label text="Posting Date" />

  <t:template>

  <c:TextView text="{ask>BUDAT}" />

  </t:template>

  </t:Column>

 

 

  <t:Column autoResizeable="true">

  <Label text="Account" />

  <t:template>

  <c:TextView text="{ask>TEXT1}" />

  </t:template>

  </t:Column>

 

 

  <t:Column autoResizeable="true">

  <Label text="Amount" />

  <t:template>

  <c:TextView text="{ask>WRBTR}" />

  </t:template>

  </t:Column>

 

 

  <t:Column autoResizeable="true">

  <Label text="Tax" />

  <t:template>

  <c:TextView text="{ask>MWSKZ}" />

  </t:template>

  </t:Column>

 

 

  <t:Column autoResizeable="true">

  <Label text="Text" />

  <t:template>

  <c:TextView text="{ask>SGTXT}" />

  </t:template>

  </t:Column>

 

 

  <t:Column autoResizeable="true">

  <Label text="Progress" />

  <t:template>

  <c:TextView text="{ask>BSTEX}" />

  </t:template>

  </t:Column>

  </t:columns>

  </t:Table>

 

 

component.js

 

jQuery.sap.declare("com.SJA.Component");

 

 

sap.ui.core.UIComponent.extend("com.SJA.Component",{

metadata : {

  rootView : "com.SJA.route.App",

 

  routing : {

        config : {

              viewType:"JS",

              viewPath:"route",       

              targetAggregation:"pages", 

              clearTarget : false

        },

        routes : [

                  {

                  pattern : "",

                  viewType : "XML",

                  name : "Login",

                  view : "Login",

                  targetControl:"navContainer",

                        targetAggregation:"pages",

                  },

                

                  {

                        pattern:"splitApp",

                        name:"SplitApp",

                        view:"SplitApp",

                        targetControl:"navContainer",

                        targetAggregation:"pages",

                        subroutes:[{

                              pattern:"splitApp/",

                              viewType: "XML",

                              name:"Master",

                              view:"Master",

                              targetControl:"SplitApp",

                              targetAggregation:"masterPages",

                      

                        subroutes:[

                        {

                        pattern:"SplitApp/CommonView/APDocument",

                        viewType: "XML",

                        viewPath: "route/CommonView",

                        name:"APDocument",

                            view:"APDocument",

                            targetControl:"SplitApp",

                            targetAggregation:"detailPages"

                            

                        },

                        {

                        pattern:"SplitApp/CommonView/ARCreditMemo",

                        viewType: "XML",

                        viewPath: "route/CommonView",

                        name:"ARCreditMemo",

                            view:"ARCreditMemo",

                            targetControl:"SplitApp",

                            targetAggregation:"detailPages"

                            

                        }],

                        }]

                  }],     

  }

}

 

 

});

 

 

com.SJA.Component.prototype.init = function(){

    jQuery.sap.require("sap.ui.core.routing.History");

    jQuery.sap.require("sap.m.routing.RouteMatchedHandler");

  

    sap.ui.core.UIComponent.prototype.init.apply(this);

  

    var router = this.getRouter();

    this.routeHandler = new sap.m.routing.RouteMatchedHandler(router);

    router.register("appRouter");  // Assign a name to Router, so that we can access it in all controllers by using this name

    router.initialize(); // Initialise the Router 

};

com.SJA.Component.prototype.createContent = function(){

    var view = sap.ui.view({viewName:"route.App",type:sap.ui.core.mvc.ViewType.JS});

    return view;

};

 

 

I attached bind message. I don't know why binding is 0. any one help this problem?


Viewing all articles
Browse latest Browse all 2806

Trending Articles



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