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

RowAction does not fire when row expand button clicked

6 Answers 69 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.
KMF
Top achievements
Rank 1
KMF asked on 26 Oct 2010, 04:46 PM
I have a basic grid with Master/Detail nesting, I have used the demo/samples provided on this site and the data seems to be loading just fine. If I set the code to automatically expand the first row, it works, the data is there for both the Master and the detail records. However, when I click on the expand button for any row, the RowAction does not fire, and thus the detail for any other row will not display. What am I missing to get RowAction to fire when the expand button is clicked?

View code:
<table id="list" class="scroll" cellpadding="0" cellspacing="0">
<% Html.Telerik().Grid(Model)
        .Name("MasterEvents")  
        .DataKeys(keys => keys.Add(e => e.master_event_id))
        .DetailView(detailView => detailView.Template(e =>
            {
                Html.Telerik().Grid(e.utilityEvents)
                 .Name("activities_" + e.master_event_id)
                  .DataKeys(keys => keys.Add(c => c.event_id))
                    .Columns(columns =>
                    {
                        columns.Bound(o => o.event_id).Width(100);
                        columns.Bound(o => o.name).Width(200);
                        columns.Bound(o => o.description);
                        columns.Bound(o => o.start_date).Format("{0:MM/dd/yyyy}").Width(120);
                        columns.Bound(o => o.end_date).Format("{0:MM/dd/yyyy}").Width(120);
                    })                             
                            .Pageable()
                            .Render();
            }))
        .Columns(columns =>
        {
            columns.Bound(o => o.masterEvent.master_event_id).Width(100);
            columns.Bound(o => o.masterEvent.title).Width(200);
            columns.Bound(o => o.masterEvent.description);
            columns.Bound(o => o.masterEvent.start_date).Format("{0:MM/dd/yyyy}").Width(120);
            columns.Bound(o => o.masterEvent.end_date).Format("{0:MM/dd/yyyy}").Width(120);
        })
        .RowAction(row =>
        {
            if (row.Index == 0)
            {
                row.DetailRow.Expanded = true;
            }
            else
            {
                var requestKeys = Request.QueryString.Keys.Cast<string>();
                var expanded = requestKeys.Any(key => key.StartsWith("activities_" + row.DataItem.master_event_id));
                row.DetailRow.Expanded = expanded;
            }
        })       
        
        .Selectable()
        .Sortable()
        .Pageable()       
        .Render();

       %>
Site.Master:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">   
    <link href="../../Content/Site.css" rel="stylesheet" type="text/css" />
    <link href="../../Content/Themes/redmond/jquery-ui-1.8.5.custom.css" rel="stylesheet"
        type="text/css" />
    <title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>        
<%= Html.Telerik().StyleSheetRegistrar()
    .DefaultGroup(group => group.Add("telerik.common.css").Add("telerik.vista.css").Combined(true).Compress(true)) %>  
   <script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
   <script src="../../Scripts/jquery.jqGrid.min.js" type="text/javascript"></script>     
</head>

<body>
<div id="logindisplay"></div>                
<div id="menucontainer">
<h3>&nbsp;&nbsp;&nbsp;Events Scheduling System</h3>
                <ul id="menu">             
                    <li><%: Html.ActionLink("Events", "Index", "MasterEvent")%></li>
                     <li><%: Html.ActionLink("Locations", "Index", "Locations")%></li>
                      <li><%: Html.ActionLink("Resources", "Index", "Resources")%></li>
                    
                </ul>
            
            </div>    

        <div id="main">   
            <asp:ContentPlaceHolder ID="MainContent" runat="server" />
        </div>
            <div id="footer">
                        </div>           

<% Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true)); %></body>
</html>

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 26 Oct 2010, 04:58 PM
Hi KMF,

 By design the expand button shows the detail view on the client-side. There is no way to fire the server-side RowAction from client-side code.

On a side note I think there is a problem with your script registration code. The way it is configured it will not render. This:

<% Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true)); %>

should be:

<%= Html.Telerik().ScriptRegistrar().DefaultGroup(group => group.Combined(true).Compress(true)) %>

Regards,
Atanas Korchev
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
0
KMF
Top achievements
Rank 1
answered on 26 Oct 2010, 05:18 PM
Yes, I have changed that and it still does not work. Essentially I am following this demo/example http://demos.telerik.com/aspnet-mvc/grid/hierarchyserverside on the telerik site, so what I am missing for this expand?
0
Atanas Korchev
Telerik team
answered on 26 Oct 2010, 05:28 PM
Hello KMF,

 You also seem to be included an unsupported version of jquery - 1.4.1. The grid supports only 1.4.2 and the script registrar will include it automatically. You can try removing the following
<script src="../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="../../Scripts/jquery.jqGrid.min.js" type="text/javascript"></script>

If you are still having trouble please attach a sample project here. We will check it out and help you.

Regards,
Atanas Korchev
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
0
KMF
Top achievements
Rank 1
answered on 26 Oct 2010, 06:09 PM
hmm....still not working, will have to post my solution here shortly...
0
KMF
Top achievements
Rank 1
answered on 26 Oct 2010, 07:05 PM
Ok, I have followed the demo exactly and checked all the file versions, I am still not able to get this working. I have send my solution in via Support ID:360862 -- Expand/Collapse does not work, RowAction does not get called. Thanks for your help!
0
KMF
Top achievements
Rank 1
answered on 26 Oct 2010, 08:09 PM
ok, got it working. The issue was related to the grid being nested in a <table></table> element that did not contain corresponding <tr><td> tags....
Tags
Grid
Asked by
KMF
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
KMF
Top achievements
Rank 1
Share this question
or