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

[Solved] Grid grouping breaking client selection

1 Answer 30 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dustin
Top achievements
Rank 1
Dustin asked on 02 Feb 2011, 02:05 AM
I am using the latest release (2010.3.1318). I have grid that implements a client selection function and grouping. The client selection works fine until the grid is grouped. Upon grouping the click event is working but there is no data in passed.

Grid Helper
    <%: Html.Telerik().Grid<AccountList>()
            .DataBinding(dataBinding => dataBinding.Ajax().Select("_IndexBinding""Home"new { Area = "Account" }))
            .Name("Accounts")
            .Columns(columns =>
            {
                columns.Bound(p => p.UserID).Hidden(true);
                columns.Bound(p => p.DisplayName);
                columns.Bound(p => p.Email);
                columns.Bound(p => p.FirstName);
                columns.Bound(p => p.LastName);
                columns.Bound(p => p.AccountType);
                columns.Bound(p => p.Status);
            })
            .Pageable()
            .Sortable(sorting => sorting.SortMode(GridSortMode.MultipleColumn).OrderBy(sortOrder => sortOrder.Add(o => o.DisplayName).Ascending()))
            .Filterable()
            .Groupable()
            .Selectable()
            .ClientEvents(events => events.OnRowSelect("Grid_onRowSelect"))        
    %>  Javascript
    <%: Html.Telerik().ScriptRegistrar() %>
    <script type="text/javascript">
        function Grid_onRowSelect(e) {
            window.location = '<%: ResolveUrl("~/Account/Manage/") %>' + e.row.cells[0].innerHTML;
        }
    </script>

Any help is appreciated!

1 Answer, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 02 Feb 2011, 09:09 AM
Hello Dustin,

The observed behavior is caused by the fact that when grid is grouped the cell index in shifted. Therefore, the logic in the RowSelect event handler is getting the value of the group cell instead of the first data cell. In order to correct this you should add the group's count when getting the cell by its index.

function Grid_onRowSelect(e) {
    window.location = '<%: ResolveUrl("~/Account/Manage/") %>' +
               e.row.cells[$(this).data("tGrid").groups.length].innerHTML;
}


Regards,
Rosen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Dustin
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Share this question
or