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

Expanding groups propagates to detail tables with GroupLoadMode="Client"

1 Answer 50 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fredrik
Top achievements
Rank 1
Fredrik asked on 28 Apr 2011, 12:33 PM
Hello,

I am having a problem when I use GroupLoadMode="Client" and HierarchyLoadMode="Client" with a RadGrid. The problem is that when I expand a group, all of the group's row's detail tables expand as well.

Is there a setting to stop this or any way to work around this? Fetching the data in our real life application is costly so the client modes are the only acceptable ones for the scenario.

The markup looks like below and is being fed data from a dataset, also shown below.
<telerik:RadGrid ID="RadGrid1" runat="server">
    <MasterTableView DataMember="Employee" DataKeyNames="ID"  GroupLoadMode="Client" HierarchyLoadMode="Client" GroupsDefaultExpanded="false">
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="Location" />
                </GroupByFields>
                <SelectFields>
                    <telerik:GridGroupByField FieldName="Location" />
                </SelectFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
        <DetailTables>
            <telerik:GridTableView DataMember="EmployeeProperties" DataKeyNames="ID">
                <ParentTableRelation>
                    <telerik:GridRelationFields MasterKeyField="ID" DetailKeyField="EmployeeID" />
                </ParentTableRelation>
            </telerik:GridTableView>
        </DetailTables>
    </MasterTableView>
</telerik:RadGrid>

protected override void OnInit(EventArgs e)
{
    RadGrid1.NeedDataSource += new Telerik.Web.UI.GridNeedDataSourceEventHandler(RadGrid1_NeedDataSource);
    RadGrid1.DetailTableDataBind += new Telerik.Web.UI.GridDetailTableDataBindEventHandler(RadGrid1_DetailTableDataBind);
    base.OnInit(e);
}
 
void RadGrid1_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e)
{
    DataSet ds = GetDataSource();
    e.DetailTableView.DataSource = ds;
}
 
void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
    DataSet ds = GetDataSource();
    RadGrid1.DataSource = ds;
}
 
private DataSet GetDataSource()
{
    DataSet ds = new DataSet();
    DataTable employee = ds.Tables.Add("Employee");
    DataTable employeeProperties = ds.Tables.Add("EmployeeProperties");
 
    var empKey = employee.Columns.Add("ID", typeof(int));
    employee.Columns.Add("FullName", typeof(string));
    employee.Columns.Add("DepartmentID", typeof(string));
    employee.Columns.Add("Location", typeof(string));
 
    var empPKey = employeeProperties.Columns.Add("ID", typeof(int));
    var empPFK = employeeProperties.Columns.Add("EmployeeID", typeof(int));
    employeeProperties.Columns.Add("Title", typeof(string));
    employeeProperties.Columns.Add("Value", typeof(string));
 
    employee.PrimaryKey = new[] { empKey };
    employeeProperties.PrimaryKey = new[] { empPKey };
    ds.Relations.Add(new DataRelation("rel", empKey, empPFK));
 
    employee.Rows.Add(new object[] { 1, "Scott Smith", 1, "Sweden" });
    employee.Rows.Add(new object[] { 2, "Adam West", 1, "Sweden" });
    employee.Rows.Add(new object[] { 3, "John Doe", 2, "Norway" });
    employee.Rows.Add(new object[] { 4, "Sven Svensson", 2, "Norway" });
    employee.Rows.Add(new object[] { 5, "Anders Andersson", 3, "Finland" });
    employee.Rows.Add(new object[] { 6, "Jane Doe", 3, "Finland" });
    employee.Rows.Add(new object[] { 7, "Stan Smith", 4, "United States of America" });
 
    int i = 0;
    foreach (DataRow emp in employee.Rows)
    {
        string[] s = ((string)emp["FullName"]).Split(new[] { ' ' });
        employeeProperties.Rows.Add(new object[] { ++i, (int)emp["ID"], "GivenName", s[0] });
        employeeProperties.Rows.Add(new object[] { ++i, (int)emp["ID"], "GivenName", s[1] });
    }
 
    return ds;
}

Regards,
Fredrik Hult

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 04 May 2011, 08:19 AM
Hello Fredrik,

I was able to reproduce the issue locally and confirm that the grid does not behave as expected in this scenario. I have forwarded your report to our developers for further investigation. Unfortunately, I can not provide you with exact estimate about when the problem will be fixed. However, you can follow the status of the issue in our public issue tracking system.

Meanwhile as a temporary workaround you can set one of the load modes (group or hierarchy) to one of its server side options.

Please excuse us for the inconvenience.

Greetings,
Martin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Fredrik
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or