以下是我到目前为止所做的代码片段。
$("#grid1").kendoGrid({
dataSource: {
transport: {
read: { url: "@Url.Action("GetDetails")", data: { projectId: '@Session["ProjectId"]' }, type: "GET", dataType: "Json" }
},
pageSize: 20,
group: [{ field: "EmployeeName", aggregates: [{ field: "Effort", aggregate: "sum" }] }, { field: "Start", aggregates: [{ field: "Effort", aggregate: "sum" }] }]
},
toolbar: kendo.template($("#template").html()),
// groupable: true,
height:"750",
sortable: true,
filterable: true,
reorderable: true,
navigatable: true,
selectable: "multiple",
columnMenu: true,
resizable: true,
pageable: {
refresh: true,
pageSizes: true,
buttonCount: 8
},
dataBound: onDataBound,
columns: [
{
title: "#",
template: "#= ++record #",
width: 30
},
{
field: "EmployeeName",
hidden: true,
groupHeaderTemplate: '#= ResourceTemplate(value)#'
},
{
field: "ProjectCode",
title: "ProjectCode",
},
{
field: "Geography",
title: "Geography",
},
{
field: "Manager",
title: "Manager",
}, {
field: "Title",
title: "Task",
},
{
field: "Effort",
title: "Effort",
aggregates: ["sum"],
groupFooterTemplate: "Total Effort: #=sum# hours"
},
{
field: "Rate",
title: "Rate",
groupable: true
},
{
field: "Frequency",
title: "Frequency",
groupable: true
},
{
field: "Start",
hidden: true,
title: "Date",
format: "{0:dd/MM/yyyy}",
filterable: {
ui: "datepicker"
},
type: "date"
}
],
dataBinding: function () {
record = (this.dataSource.page() - 1) * this.dataSource.pageSize();
},
change: function (arg) {
var selected = $.map(this.select(), function (item) {
return $(item).find('td').first().text();
});
},
});
默认情况下,网格按EmployeeName和Date分组。我只想要员工的总工作量(44小时),但是按日期分组会导致日期明智的总工作量(6小时28小时)也不需要。我怎么能避免这种情况。