Kendo ui Kendo Mobile-当listview的数据源上的服务器分组为true时,数据不显示
我已经成功地将数据源的数据服务器端分组为移动listview,但是,我无法将其显示在屏幕上。Kendo ui Kendo Mobile-当listview的数据源上的服务器分组为true时,数据不显示,kendo-ui,kendo-mobile,Kendo Ui,Kendo Mobile,我已经成功地将数据源的数据服务器端分组为移动listview,但是,我无法将其显示在屏幕上。\u pristine数据中的数据以以下结构正确显示我的数据: results: Array[12] // 12 groups total 0 = Array[5] // first group 0 = Object // groupID lives here total: 14 以下是我的数据源定义的相关部分: schema: { g
\u 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",
.
.
.
我的数据源可以很好地用于客户端分组 当我这样使用它时,我得到了正确的答案
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数据源中查找服务器分组的人