当我这样使用它时,我得到了正确的,
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 的人有所帮助。