Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3523

Table control bind nest table json issue

$
0
0

Hi,

   I want to display a json data as follow:

{

  "PreqNo" : "10090595",

  "PrType" : "NB",

  "Testrun" : "",

  "Commit" : "",

  "Eerpid" : "",

  "Code" : "S",

  "Message" : "采购申请读取成功;",

  "ApplicationNumber" : "SP00115081200014",

  "ApplicationID" : "002573",

  "SN" : "13791_17",

  "Items" : [{

  "PreqNo" : "10090595",

  "PreqItem" : "00010",

  "DocType" : "NB",

  "PurGroup" : "A50",

  "CreatedBy" : "HH_ZHAOWEI",

  "PreqName" : "liufang4",

  "DelivDate": "2015-08-11T00:00:00",

  "ShortText" : "Test11111111111111111",

  "Plant" : "2293",

  "Quantity" : "1.000",

  "Unit" : "AU",

  "ItemCat" : "9",

  "Acctasscat" : "K",

  "PurchOrg" : "1123",

  "Currency" : "CNY",

  "Accounts" : [{

  "PreqNo" : "10090595",

  "PreqItem" : "00010",

  "SerialNo" : "01",

  "PreqQty" : "1.000",

  "GLAcct" : "4301010099",

  "CostCtr" : "1442060301"

  }],

  "AddrDeliverys" : [{

  "PreqNo" : "10090595",

  "PreqItem" : "00010",

  "AddrNo" : "101684",

  "Name" : "山东海化纯碱厂工厂",

  "City" : "潍坊",

  "Street" : "山东省潍坊市滨海经济开发区大家洼镇沂河大街14201号",

  "Country" : "CN",

  "Tel1Numbr" : "0536-00",

  "FaxNumber" : "0536-00",

  "StreetLng" : "山东省潍坊市滨海经济开发区大家洼镇沂河大街14201号"

  }],

  "ServiceLines" : [{

  "PreqNo" : "10090595",

  "PreqItem" : "00010",

  "SerialNo" : "01",

  "ExtLine" : "0000000010",

  "Quantity" : "1.000",

  "BaseUom" : "LE",

  "GrPrice" : "1.0000",

  "ShortText" : "Firoi测试服务行1"

  }, {

  "PreqNo" : "10090595",

  "PreqItem" : "00010",

  "SerialNo" : "01",

  "Quantity" : "10000.000",

  "BaseUom" : "LE",

  "GrPrice" : "1.0000",

  "ShortText" : "Firoi测试服务行2"

  }],

  "TextLines" : [{

  "PreqNo" : "10090599",

  "PreqItem" : "00010",

  "TextId" : "B01",

  "TextLine" : "我是Firoi测试行项目文本"

  }, {

  "PreqNo" : "10090599",

  "PreqItem" : "00010",

  "TextId" : "B09",

  "TextLine" : "我是Firoi测试行项目文本999"

  }]

  }],

  "TextLines" : [{

  "PreqNo" : "10090595",

  "PreqItem" : "00000",

  "TextId" : "B02",

  "TextLine" : "我是Firoi测试文本"

  }]

}

 

Component.js      load json data from a file,actually it is a template

var rootPath = jQuery.sap.getModulePath("cnooc.servpr.approve");

var newModel = new sap.ui.model.json.JSONModel(rootPath + "/model/new.json");

oView.setModel(newModel, "new");

 

Master.controller.js      navigate function,it woks well

handleCreate : function(evt) {

  var newModel = this.getView().getModel("new");

  var newContext = new sap.ui.model.Context(newModel, "/");

  this.nav.to("Create", newContext);

  }

 

Create.view.xml     display header info and Items table,it woks well

<Input type="Text" placeholder="{i18n>PrType}" value="{new>/PrType}"></Input>

<Table id="createItems" headerText="" items="{new>/Items}" >

.......

<ColumnListItem type="Navigation" press="handleLineItemPress" >

  <cells>

  <Input type="Text" placeholder="{i18n>PreqItem}" value="{new>PreqItem}" />

  <Input type="Text" placeholder="{i18n>Quantity}" value="{new>Quantity}" />

  <Input type="Text" placeholder="{i18n>DelivDate}" value="{new>DelivDate}" />

  <Input type="Text" placeholder="{i18n>ShortText}" value="{new>ShortText}" />

  <Button icon="sap-icon://delete" press="handleDeleteItem" />

  </cells>

  </ColumnListItem>

 

Create.controller.js    navigate function,I wonder is there wrong?

handleLineItemPress : function(evt) {

var context = evt.getSource().getBindingContext("new");

this.nav.to("CreateItem", context);

}


CreateItem.view.xml    display Item info and Accounts table etc. it doesn't work well, I can't get any data on the page

<ObjectHeader title="{new>PreqItem}" number="{new>Quantity}" numberUnit="{new>Unit}">

  <attributes>

  <ObjectAttribute text="{i18n>ItemCat}:{new>ItemCat}" />

  <ObjectAttribute text="{i18n>Acctasscat}:{new>Acctasscat}" />

  <ObjectAttribute text="{i18n>Material}:{new>Material}" />

  </attributes>

  </ObjectHeader>

 

<Table id = "Accounts" headerText="" items="{new>Accounts}" >

.......

 

<ColumnListItem>

  <cells>

  <ObjectIdentifier title="{new>SerialNo}" />

  <ObjectNumber number="{new>PreqQty}" numberUnit="" />

  <Text text="{new>GLAcct}"/>

  <Text text="{new>CostCtr}"/>

  <Text text="{new>ProfitCtr}"/>

  <Button icon="sap-icon://delete" press="handleDeleteAccount" />

  </cells>

</ColumnListItem>



is there something wrong with data binding?(I can't use newModel as default model for some reason.)

QQ截图20150816232141.png


QQ截图20150816232235.png


thank you.

best regards,

felix.







Viewing all articles
Browse latest Browse all 3523

Trending Articles



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