2016-11-05 15 views
0

ODATA SAPUI5 응용 프로그램에서 모형 데이터로 중첩 JSON 파일을 사용하고 있지만 중첩 데이터에 액세스 할 수 없습니다.ODATA SAPUI5 모형의 중첩 JSON

JSON 내보기 파일에서 내용

[{ 
"testcase": {  
    "specification": "SRS PR 28717 – Deposit in Brazilian Reais", 
    "execution": { 
     "description": "DESC", 
     "bca_cn_acct_01": { 
      "header": { 
       "section": "Field/Section Name", 
       "data": "Data to Enter/Value to Select", 
       "action": "Activity/Check/Comment" 
      }, 
      "frame": { 
       "ID": 1, 
       "title": "Create Account: Initial Screen", 
       "data": [{ 
        "key": "Contract Start", 
        "value": "02/16/2000", 
        "action": "" 
       }, { 
        "key": "Contract Manager", 
        "value": "GH_RAMOSCL", 
        "action": "" 
       }, { 
        "key": "Product", 
        "value": "BR_IOFTC3", 
        "action": "" 
       }, { 
        "key": "Account Holder", 
        "value": "GH_IOF_COR", 
        "action": "Press Enter" 
       }] 
      } 

     } 
    }, 
    "result": "Teste" 
}}] 

, 나는 목록으로, 태그 내부의 데이터에 액세스하려면 :

<core:View controllerName="sap.ui.demo.MockServer.controller.App" xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml" 
xmlns="sap.m"> 
<!-- <List headerText="{i18n>headerText}" id="list" items="{/Meetups}" noDataText="{i18n>noDataText}"> 
    <items> 
     <ObjectListItem number="{ path: 'EventDate', type: 'sap.ui.model.type.DateTime', formatOptions: { style: 'medium' } }" title="{Title}"> 
      <attributes> 
       <ObjectAttribute text="{Description}"/> 
      </attributes> 
     </ObjectListItem> 
    </items> 
</List> 
<Button press="onPressAction" text="{i18n>loadFirstItems}"></Button> --> 
<List headerText="{i18n>headerText}" id="list" items="{/Meetups}" noDataText="{i18n>noDataText}"> 
    <items> 
     <ObjectListItem number="{ path: 'EventDate', type: 'sap.ui.model.type.DateTime', formatOptions: { style: 'medium' } }" 
      title="{testcase/execution/description}"> 
      <attributes> 
       <ObjectAttribute text="{specification}"/> 
      </attributes> 
     </ObjectListItem> 
    </items> 
</List> 
<Table id="table" items="{/Meetups}"> 
    <columns> 
     <Column width="12em"> 
      <Text text="Field/Section Name"/> 
     </Column> 
     <Column minScreenWidth="Tablet" demandPopin="true"> 
      <Text text="Data to Enter/Value to Select"/> 
     </Column> 
     <Column minScreenWidth="Tablet" demandPopin="true"> 
      <Text text="Activity/Check/Comment"/> 
     </Column> 
    </columns> 
    <items> 
     <ColumnListItem> 
      <cells> 
       <ObjectIdentifier title="{testcase/execution/bca_cn_acct_01/frame/data/key}" class="sapMTableContentMargin"/> 
       <!-- <Text text="{testcase/execution/bca_cn_acct_01/bca_dte_event_begin_d}" /> --> 
       <Text text="{testcase/execution/bca_cn_acct_01/frame/data/value}"/> 
      </cells> 
     </ColumnListItem> 
    </items> 
</Table> 
<Button press="onPressAction" text="{i18n>loadFirstItems}"></Button> 

그러나, 필드의 데이터 키 값은 JSON 데이터 태그 내부의 배열이지만 목록으로 검색되지 않습니다.

내가 기지로 샘플 SAPUI5 라이브러리에서 튜토리얼 사용

<?xml version="1.0" encoding="utf-8" standalone="yes"?> 
<edmx:Edmx Version="1.0" 
    xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx"> 
    <edmx:DataServices 
     xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="1.0"> 
     <Schema Namespace="NerdMeetup.Models" 
      xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" 
      xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" 
      xmlns="http://schemas.microsoft.com/ado/2006/04/edm">    
      <EntityType Name="Meetup">     
       <ComplexType Name="testcase"> 
        <ComplexType Name="execution"> 
         <!-- Create Payment Item --> 
         <ComplexType Name="bca_cn_acct_01"> 
          <ComplexType Name="header"> 
           <Property Name="section" Type="Edm.String" Nullable="false" /> 
           <Property Name="data" Type="Edm.String" Nullable="false" /> 
           <Property Name="action" Type="Edm.String" Nullable="false" /> 
          </ComplexType> 
          <ComplexType Name="frame"> 
           <Property Name="ID" Type="Edm.Int32" Nullable="false" /> 
           <Property Name="title" Type="Edm.String" Nullable="false" /> 
           <ComplexType Name="data"> 
            <Property Name="key" Type="Edm.Int32" Nullable="false" /> 
            <Property Name="value" Type="Edm.Int32" Nullable="false" /> 
            <Property Name="action" Type="Edm.Int32" Nullable="true" /> 
           </ComplexType> 
          </ComplexType> 
          <Property Name="bca_dte_event_begin_d" Type="Edm.String" Nullable="false" /> 
          <Property Name="bca_dte_orgunit_cnmgt" Type="Edm.String" Nullable="false" /> 
          <Property Name="fspr_prodext_y" Type="Edm.String" Nullable="false" /> 
          <Property Name="bca_dte_bupa_acchold" Type="Edm.String" Nullable="false" /> 
         </ComplexType> 
        </ComplexType> 
        <Property Name="specification" Type="Edm.String" Nullable="true" /> 
       </ComplexType>    
      </EntityType> 
      <EntityContainer Name="NerdMeetups" m:IsDefaultEntityContainer="true"> 
       <EntitySet Name="Meetups" EntityType="NerdMeetup.Models.Meetup" /> 
       <FunctionImport Name="FindUpcomingMeetups" EntitySet="Meetups" ReturnType="Collection(NerdMeetup.Models.Meetup)" m:HttpMethod="GET" /> 
      </EntityContainer> 
     </Schema> 
    </edmx:DataServices> 
</edmx:Edmx> 

어떤 아이디어 : 내가 사용 된 메타 데이터 파일을 찾을 수 있습니다 아래 https://sapui5.hana.ondemand.com/#docs/guide/7a78f1b707c248fd9ec53dcb5f10814c.html

그리고를?

{testcase/execution/bca_cn_acct_01/frame/data/} 

또는 배열의 특정 요소 바인딩 :

{testcase/execution/bca_cn_acct_01/frame/data/0/key} 

또한받을 포맷을 사용할 수를

포옹은

+1

샘플 코드를 확인할 수 있습니까? 목록에 items = "{/ Meetups}"가 표시되지만 JSON에 'meetups'라는 노드가 없습니다. 샘플을 준비하는 동안 편집 오류가 아니라면 이것이 문제일까요? 마찬가지로 bjectListItem 경로의 경로 : 'EventDate'가 잘못되었습니다. 전반적으로 나는이 단계에서 당신의 질문이 불분명하다고 말할 것입니다. –

+0

원래 게시물에 새로운 정보가 추가되었습니다. –

답변

0

난 당신이 전체 배열을 결합 할 수 있습니다 추측 배열과 배열의 모든 키를 연결합니다. Formatter SAPUI5 documentation

+0

안녕하세요, Roggia 첫 번째 옵션은 작동하지 않고 두 번째 옵션 (/ 0 /)은 작동하지만 정적 특성으로 인해 기존 항목 수에 따라 콘텐츠를 dinamically 추출 할 수 없습니다. –