I am using below code for the grid. I am getting below two issue
1) When grouping the columns, the group headers are expanded by default. I want to make them collapsed as soon as I do grouping on any column. Could someone help on this.
2) Also how can I find out the groupable column name, as I need to pass that column name to a different function for chart population.
Please help.
Here is code
---------------
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="Scripts/jquery.min.js" type="text/javascript"></script>
<script src="Scripts/kendo.web.min.js" type="text/javascript"></script>
<link href="styles/kendo.common.min.css" rel="stylesheet" type="text/css" />
<link href="styles/kendo.default.min.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="example" class="k-content">
<div id="grid"> </div>
<script>
$(document).ready(function () {
$("#grid").kendoGrid({
dataSource: {
type: "odata",
serverPaging: false,
serverSorting: false,
pageSize: 1000,
transport: {
read: "http://demos.kendoui.com/service/Northwind.svc/Orders"
},
group: {
field: "ShipCity", aggregates: [
{ field: "OrderID", aggregate: "count" },
{ field: "CustomerID", aggregate: "count" },
{ field: "ShipName", aggregate: "count" },
{ field: "ShipCity", aggregate: "count" }
]
},
aggregate: [{ field: "OrderID", aggregate: "count" },
{ field: "CustomerID", aggregate: "count" },
{ field: "ShipName", aggregate: "count" },
]
},
height: 280,
scrollable: {
virtual: false
},
sortable: true,
groupable: true,
columns: [
{ field: "OrderID", aggregates: "count", groupHeaderTemplate: "OrderID: #= value # (Count: #= count#)" },
{ field: "CustomerID", aggregates: "count", groupHeaderTemplate: "CustomerID: #= value # (Count: #= count#)", footerTemplate: "Total Count: #=count#" },
{ field: "ShipName", title: "Ship Name", aggregates: "count", groupHeaderTemplate: "ShipName: #= value # (Count: #= count#)" },
{ field: "ShipCity", title: "Ship City", aggregates: "count", groupHeaderTemplate: "ShipCity: #= value # (Count: #= count#)" }
],
databound: function () {
$("#grid").find(".k-icon.k-collapse").trigger("click");
}
});
});
</script>
</div>
</body>
</html>