我已成功将数据源的数据服务器端分组为移动列表视图,但是,我无法将其显示在屏幕上。 _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",
.
.
.
我的数据源与客户端分组工作正常。
答案 0 :(得分: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;
我不确定,如果这是获取服务器端记录的最有效方法。如果有人有更好的想法以更有效的方式获取记录,请建议。
希望这有助于在kendo数据源中寻找Servergrouping的人。