Migrating from Telerik to Kendo Grid, Now Im having a problem auto-opening the detail template for the selected row within a grid...
See the following...
<script type="text/javascript">
function products_onRowSelect(e) {
collapseAll(e);
var grid = $("#Products").data("kendoGrid"),
row = grid.tbody.find(">tr.k-master-row k-state-selected");
if (row.has(".k-collapse").length) {
grid.collapseRow(row);
} else {
grid.expandRow(row);
}
}
function collapseAll(e) {
var grid = $("#Products").data("kendoGrid");
var allMasterRows = grid.tbody.find('>tr.k-master-row');
//Loop through each row, if a row has a detail row following it then collapse that master row
for (var i = 0; i < allMasterRows.length; i++)
{
if (allMasterRows.eq(i).next('tr.k-detail-row').length > 0)
{
grid.collapseRow(allMasterRows.eq(i));
}
}
}
</script>
Runs without error, collapse all works fine, but the expand never happens... Breakpoint hits just fine, but the row doesnt expand through code, it does however if I click the expand icon within the grid, just the jScript function doesnt do it.. Any ideas?
See the following...
<script type="text/javascript">
function products_onRowSelect(e) {
collapseAll(e);
var grid = $("#Products").data("kendoGrid"),
row = grid.tbody.find(">tr.k-master-row k-state-selected");
if (row.has(".k-collapse").length) {
grid.collapseRow(row);
} else {
grid.expandRow(row);
}
}
function collapseAll(e) {
var grid = $("#Products").data("kendoGrid");
var allMasterRows = grid.tbody.find('>tr.k-master-row');
//Loop through each row, if a row has a detail row following it then collapse that master row
for (var i = 0; i < allMasterRows.length; i++)
{
if (allMasterRows.eq(i).next('tr.k-detail-row').length > 0)
{
grid.collapseRow(allMasterRows.eq(i));
}
}
}
</script>