2016-10-11 2 views
-1

約200件のエントリを表示するには、sap.m.Tableを使用する必要があります。私は成長する財産を使う必要があることを知っていました。しかし、「growing:true、growingThreshold:100」を追加すると、テーブルには100個のエントリが表示され、「more」ボタンは表示されません。JSONModelでテーブルが成長しない

この問題に関するいくつかのブログ記事を読んだことがあります。私は私のモデルのsetSizeLimitを試しましたが、動作しませんでした。私はデフォルトのcountModeでJSONModelを使用しています。私が試すことができる何か他にありますか?

ありがとうございます!

答えて

1

サイズ制限を設定することは、増加する機能には関係なく、リストバインディングで使用されるエントリの最大数に影響します。 1000個のエントリを格納しており、サイズの制限は500です。これらのエントリにバインドされたリストコントロールは500だけ表示されます。

JSONModelは多かれ少なかれダムのデータストアであり、知識のない拡張機能をサポートしていませんデータの全体的なカウントを取得する方法について説明します。これを実現するには、独自のリストバインディングを実装して、特定のケースのデータ数を計算する必要があります。また、このリストバインディングを使用するカスタムモデルが必要です。

JSONModel

sap.ui.define([ 
     "sap/ui/model/json/JSONModel", 
     "xxx/ListBinding" 
    ], function(JSONModel, ListBinding) { 
     "use strict"; 

     return JSONModel.extend("xxx.JSONModel", { 

      bindList : function(path, context, sorters, filters, parameters) { 
       return new ListBinding(this, path, context, sorters, filters, parameters); 
      }; 
     }); 

    }); 

ListBindingご入力のための

sap.ui.define([ 
     "sap/ui/model/json/ListBinding" 
    ], function(ListBinding) { 
     "use strict";  

     return ListBinding.extend("xxx.ListBinding", { 

      // in this case the array holding the data has a count property which stores the total number of entries 
      getLength : function() { 
       var path = !this.sPath ? "count" : this.sPath + "/count"; 
       var count = this.oModel.getProperty(path, this.oContext); 
       return (count) ? count : ListBinding.prototype.getLength.call(this); 
      } 

     }); 

}); 
+0

ありがとう!しかし、私は何とか次のようにして私の問題を解決します: – dduozz

+0

私はoTable.bindAggregation( ""、 "dfcr> /"、oTemplate)を変更しました。 to oTable.bindAggregation( "items"、 "dfcr> /"、oTemplate); – dduozz

+0

実行例を示してください。 – matbtt

関連する問題