0

モバイル リストビュー用にデータ ソースのデータ サーバー側を正常にグループ化しましたが、画面に表示できません。データ内_pristineのデータは、次の構造でデータを正しく示しています。

results: Array[12] // 12 groups total
             0 = Array[5] // first group
                 0 = Object // groupID lives here
total: 14

私のデータソース定義の関連セクションは次のとおりです。

schema: {
    groups: "[d.results]", // tried function(response) {return [response.d.results];}
    data: "d.results",
    total: "d.total",
},
serverGrouping: true,
group: "groupID",
.
.
.

私のデータソースは、クライアント側のグループ化で正常に動作します..

4

1 に答える 1

0

こうやって使ってみたらちゃんと取れた、

        serverFiltering: true,
        serverGrouping: true,
        serverSorting: true,
        serverPaging: true,
        page: 1,
        pageSize: 10,
        schema: {
            data: "results",
            groups: "groups",
            total: "total",
            model: {
                id: "id"
            }
        }

サーバーサイドでは、

    // $group_by is the string, which is processed from the $_GET['group']
    // $results are the results grouped by

    $groups = array();

    if (!empty($group_by)) {
        foreach ($results as $result) {                
            $group_result = function_to_get_results_of_one_group($result['some_field']);                
            $groups[] = array(
                'field' => "The name of the field we want to display in the group by",
                'value' => "The value of the field we want to display in the group by",
                'items' => $group_result,
                'hasSubgroups' => FALSE,
                'aggregates' => array()
            );
        }
    }

    echo json_encode(
            array(
                'results' => $results,
                'groups' => $groups,
                'total' => $countPdct
            )
    );
    exit;

これがサーバー側でレコードを取得する最も効率的な方法であるかどうかはわかりません。誰かがより効率的な方法でレコードを取得するためのより良いアイデアを持っている場合は、提案してください。

これが、剣道データソースで Servergrouping を探している人の助けになることを願っています。

于 2013-05-07T04:26:04.223 に答える