2017-10-31 7 views
-1

sap.m.TileContainerを使用してタイルをいくつかの情報で表示したいと思います。sap.m.TileContainer 2タイルだけを表示

私はSAP Web IDEにゼロからアプリケーションを構築しました。このサンプルは、実際には有用ではありません。私はタイルを表示するためにTileContainerを使用しています。そのtile集約は、ローカルのJSONデータファイルにバインドされています。

データファイルには、3つの項目を含む配列が含まれています。ただし、レンダリング後は2つしか表示されません。理由は何ですか?

これは私のdata.jsonです:

{ 
    "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" 
    }] 
} 

これは私のXMLビューです:

<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

現在のコードから2つのタイルしか表示されない理由はわかりません。ブラウザのコンソールにエラーメッセージが表示されますか?ページを更新する際に[キャッシュを無効にする](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").typeContainerを非推奨にする場合は、onLitまたはonBeforeRenderingのgetLength()= 0またはonAfterRendering –

答えて

0

ご提案

のための多くのおかげで、私はのようにタイルコンテナとそれを解決し、その間によく

私がしたことは、私がデフォルトモデルではなかったことです。 私は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() { 
     // 
     // } 

    }); 

}); 
関連する問題