This is a migrated thread and some comments may be shown as answers.

open Detail Template for the selected Row

0 Answers 146 Views
Grid
This is a migrated thread and some comments may be shown as answers.
im
Top achievements
Rank 2
im asked on 26 Jul 2012, 05:52 PM
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?

No answers yet. Maybe you can help?

Tags
Grid
Asked by
im
Top achievements
Rank 2
Share this question
or