1

Lightswitch 2013 では、特定のクエリ (FilteredIncidents) の項目 (インシデント) の総数を画面に表示したいと考えています。

「5000 件のインシデントのうち 200 件を表示しています」.

ただし、画面にロードされているアイテムの数しか取得できません。合計を表示するにはどうすればよいですか?

これは、画面に読み込まれたアイテムの数を取得するために行っていることです。

myapp.BrowseIncidents.TotalIncidents_postRender = function (element, contentItem) {
    contentItem.dataBind('screen.FilteredIncidents.count', function (value) {
        contentItem.screen.TotalIncidents = value;
    });
};
4

1 に答える 1

4

こんな関数を使っています。IDではなく要素を渡すなど、パラメータを調整して調整できます。

    function getTotalCount(entitySet, elemId) {
    entitySet
       .top(1)
       .includeTotalCount()
       .execute()
       .then(function (result1) {
           // update the total count
           document.getElementById(elemId).innerText = result1.totalCount.toString() + " rows";
       }, function (error) {
           // do whatever you want to
           totalProperty = "error";
       });
}

デイブ

于 2014-03-20T13:11:50.487 に答える