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

[Solved] Selecting the first row in a client-side master-child situation

0 Answers 109 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jason
Top achievements
Rank 1
Jason asked on 06 Feb 2012, 11:17 PM
Most of the solution suggestions say to set the class t-state-selected to a row to hilight it, but if you have a child grid on the same page using ajax binding then it makes sense to invoke the click() event on the row of the parent grid.
However, the issue we see is that the child grid insists on executing its own parameter-free 'select' call.

Example:
The main Customer grid has client events for onRowSelection and onDataBound:

Html.Telerik().Grid<CustomerAccountSummary>()
    .Name("Customers")
    .DataBinding(b => b.Ajax().Delete("JsonDeleteCustomerAccount", "Administration")
                              .Select("JsonFetchCustomerAccountSummary", "Administration")
    )
    .DataKeys(c => c.Add(i => i.CustomerAccountID))
    .ClientEvents(events => events.OnRowSelect("onRowSelected").OnDataBound("onDataBound"))

The javascript:
<script type="text/javascript">
 
    function onRowSelected(e) {
        var customerId = e.row.cells[0].innerHTML;
        $("#CustomersSlots").data("tGrid").rebind({ id: customerId });
    }
 
    function onDataBound() {
        $('#Customers').data('tGrid').$rows()[0].click();
    }
     
</script>

This all works fine except that after correctly rendering the 'CustomersSlots' grid (passing in the appropriate customerId parameter), the grid then requests the content again with a null id.
If we change the OperationMode to the Client then the call is obviously avoided, but then the user can't refresh the grid.
Is there any way to tell the grid to not request the intial data?

[Edit]
I should add that if you add GridOperationMode.Client to the second grid, the paging is disabled in the master grid and clicking to page 2 doesn't send an ajax Select request, so I assume this is a bug.
Tags
Grid
Asked by
Jason
Top achievements
Rank 1
Share this question
or