2017-10-31 6 views
-1

타일을 일부 정보와 함께 표시하려면 sap.m.TileContainer을 사용하고 싶습니다. SAP 샘플은 manifest.json 등을 사용하는 것과 같은 지침을 따르지 않으므로 유용하지 않습니다.sap.m.TileContainer 타일 2 개만 표시

그래서 SAP Web IDE에 처음부터 응용 프로그램을 만들었습니다. 타일을 표시하는 데 TileContainer를 사용하고 있습니다. 해당 tile 집계는 로컬 JSON 데이터 파일에 바인딩됩니다.

데이터 파일에는 세 가지 항목이 포함 된 배열이 들어 있습니다. 그러나 렌더링 후에는 두 개만 표시됩니다. 어떤 제안? 그 동안 귀하의 제안

에 대한

<mvc:View 
    controllerName="com.support_page.controller.App" 
    height="100%" 
    xmlns:mvc="sap.ui.core.mvc" 
    xmlns:core="sap.ui.core" 
    xmlns:tnt="sap.tnt" 
    xmlns="sap.m"> 
    <Page 
     showHeader="true" 
     enableScrolling="false"> 
     <TileContainer 
      id="container" 
      tileDelete="handleTileDelete" 
      tiles="{/TileCollection}"> 
      <StandardTile 
       icon="{icon}" 
       title="{title}" 
       info="{info}" 
       activeIcon="{flag}"/> 
     </TileContainer> 
    </Page> 
</mvc:View> 
+0

흠, 현재 코드에서 두 개의 타일 만 표시해야하는 이유는 알 수 없습니다. 브라우저 콘솔에 오류 메시지가 있습니까? 페이지를 업데이트 할 때 [캐시를 사용 중지 하시겠습니까] (https://developers.google.com/web/tools/chrome-devtools/network-performance/reference#change_loading_behavior) 하시겠습니까? 'yourTileContainer.getBinding ("tiles"). getLength()'는 무엇을 반환합니까? – boghyon

+0

Btw. ['sap.m.TileContainer'] (https://openui5nightly.hana.ondemand.com/#/api/sap.m.TileContainer/overview)뿐만 아니라'sap.m.GenericTile'을 제외한 모든 타일들은 버전 1.50에서 더 이상 사용되지 않습니다. 그냥 참고로 .. – boghyon

+0

콘솔에서 오류가 캐시를 사용할 수 없습니다. yourTileContainer.getBinding ("tiles"). getInstance 또는 onBeforeRendering에서 getLength() = 0 또는 tileContainer가 더 이상 사용되지 않는 경우 –

답변

0

많은 감사 내가 타일 컨테이너로 그것을 해결 : 이것은 내 XML 뷰입니다

{ 
    "TileCollection": [{ 
     "title": "Slovenská Republika", 
     "info": "support for SR", 
     "flag": "", 
     "icon": "sap-icon://inbox" 
    }, { 
     "title": "Deutschland", 
     "info": "support for DE", 
     "flag": "", 
     "icon": "sap-icon://inbox" 
    }, { 
     "title": "Ceska Republika", 
     "info": "support for CZ", 
     "flag": "", 
     "icon": "sap-icon://inbox" 
    }] 
} 

:

내 data.json입니다 잘.

내가 한 것은 기본 모델이 아닌 것입니다. component.js에서 모델을 초기화했습니다. 다음 모델>/TileCollection을 사용했고 여전히 약간 혼란 스럽지만 작동했습니다. 그럼에도 불구하고 대답 해 주셔서 감사합니다.

+0

문제를 해결할 수있어서 다행입니다. 당신은 또한 자신의 대답을 받아 들여 다른 사람들에게 알릴 수 있습니다. 그러나 약간 혼란스러운 부분은 무엇 이었습니까? – boghyon

-1
I solved this issue , even i was facing same issue , If you dont use local model you will not face issue or if you define your model in controller you will not face the issue. 
sap.ui.define([ 
    "sap/ui/core/mvc/Controller", 
    "sap/ui/model/json/JSONModel" 
], function(Controller,JSONModel) { 
    "use strict"; 

    return Controller.extend("SmartPurchaseReq.controller.Home", { 

     /** 
     * Called when a controller is instantiated and its View controls (if available) are already created. 
     * Can be used to modify the View before it is displayed, to bind event handlers and do other one-time initialization. 
     * @memberOf SmartPurchaseReq.view.Home 
     */ 
      onInit: function() { 
       var that = this; 
       var data = { 
    "TileCollection" : [ 
     { 
      "icon" : "sap-icon://hint", 
      "type" : "Monitor", 
      "title" : "Tiles: a modern UI design pattern for overview & navigation." 
     }, 
     { 
      "icon" : "sap-icon://inbox", 
      "number" : "89", 
      "title" : "Approve Leave Requests", 
      "info" : "Overdue", 
      "infoState" : "Error" 
     }, 
     { 
      "type" : "Create", 
      "title" : "Create Leave Requests", 
      "info" : "28 Days Left", 
      "infoState" : "Success" 
     }, 
     { 
      "icon" : "sap-icon://travel-expense-report", 
      "number" : "281", 
      "numberUnit" : "euro", 
      "title" : "Travel Reimbursement", 
      "info" : "1 day ago" 
     }, 
     { 
      "icon" : "sap-icon://loan", 
      "number" : "2380", 
      "numberUnit" : "euro", 
      "title" : "My Salary", 
      "info" : "8 days ago" 
     }, 
     { 
      "icon" : "sap-icon:`enter code here`//lab", 
      "number" : "1", 
      "numberUnit" : "Invention", 
      "title" : "Test Lab Reports", 
      "info" : "8 Days Ago" 
     }, 
     { 
      "icon" : "sap-icon://inbox", 
      "type" : "Monitor", 
      "title" : "Leave Request History" 
     }, 
     { 
      "type" : "Create", 
      "title" : "Create Purchase Order", 
      "info" : "890€ Open Budget", 
      "infoState" : "Success" 
     }, 
     { 
      "icon" : "sap-icon://stethoscope", 
      "number" : "3", 
      "title" : "Yearly Health Check", 
      "info" : "3 year overdue", 
      "infoState" : "Error" 
     }, 
     { 
      "icon" : "sap-icon://meal", 
      "type" : "Monitor", 
      "title" : "Meal Schedule" 
     } 

    ] 
}; 
       var DummyModel = new JSONModel(); 
       DummyModel.setData(data); 
       // var sPath = jQuery.sap.getModulePath("model", "/Dummy.json"); 
       // var DummyModel = new JSONModel(sPath); 
       that.getView().byId("container").setModel(DummyModel); 
      }, 
      OnTilePress: function(evt) { 
       var idj = evt.getSource(); 
       var d =5; 
      } 

     /** 
     * Similar to onAfterRendering, but this hook is invoked before the controller's View is re-rendered 
     * (NOT before the first rendering! onInit() is used for that one!). 
     * @memberOf SmartPurchaseReq.view.Home 
     */ 
     // onBeforeRendering: function() { 
     // 
     // }, 

     /** 
     * Called when the View has been rendered (so its HTML is part of the document). Post-rendering manipulations of the HTML could be done here. 
     * This hook is the same one that SAPUI5 controls get after being rendered. 
     * @memberOf SmartPurchaseReq.view.Home 
     */ 
     // onAfterRendering: function() { 
     // 
     // }, 

     /** 
     * Called when the Controller is destroyed. Use this one to free resources and finalize activities. 
     * @memberOf SmartPurchaseReq.view.Home 
     */ 
     // onExit: function() { 
     // 
     // } 

    }); 

});