I have a hierarchical grid that i populate data with 2 page methods. When the page loads the is no problem how ever if i reload the grid the rows wont expand. the detailInit event fires. (if i reload it again after the rows don't expand. then everything loads and functions correctly)
function loadGrid(startDate, endDate) {
$("#rgLeaderBoardByManager").kendoGrid({
dataSource: {
data: data
},
dataBound: function (e) {
var grid = this;
$(".k-grouping-row").each(function (e) {
grid.collapseGroup(this);
});
},
sortable: true,
scrollable: true,
detailInit: detailInit,
columns: [
{
field: "Manager",
title: "Manager"
},
{
field: "TotalSalesByManager",
title: "Total Sales"
}
]
});
function detailInit(e) {
var sd1, ed1;
var dateRange = FindControl('<%= rcmLeaderBoardByManagerWidget.ClientID %>').value;
switch (dateRange) {
case "Today":
sd1 = new Date();
ed1 = new Date();
break;
case "Yesterday":
sd1 = new Date().Add("D", -1);
ed1 = new Date().Add("D", -1);
break;
case "Week to Date":
sd1 = new Date().Add("D", -(new Date().getDay()));
ed1 = new Date();
break;
case "Last Week":
sd1 = new Date().Add("D", -(new Date().getDay() + 7));
ed1 = new Date().Add("D", -(new Date().getDay() + 1));
break;
case "Month to Date":
sd1 = new Date(new Date().getFullYear(), new Date().getMonth(), 1);
ed1 = new Date();
break;
case "Last Month":
var endOfLastMonth = new Date(new Date().getFullYear(), new Date().getMonth(), 1).Add("D", -1);
sd1 = new Date(endOfLastMonth.getFullYear());
ed1 = endOfLastMonth;
break;
}
CallWidgetHelper("GetLeaderByManagerWidgetData", function (response) {
$("<div/>").appendTo(e.detailCell).kendoGrid({
dataSource: {
data: response.d
},
scrollable: false,
sortable: true,
columns: [
{ field: "UserFullName" },
{ field: "TotalSales", title:"User"}
]
});
}, null, "startDate", sd1.format('M/d/yyyy'), "endDate", ed1.format('M/d/yyyy'),
"includeCancels", FindControl('<%= hdnIncludeCancels.ClientID %>').value,
"includeChecksPending", FindControl('<%= hdnIncludeChecksPending.ClientID %>').value, "managerId", e.data.ManagerId);
}
}