This is a migrated thread and some comments may be shown as answers.
Grouping, Sorting by Associated Properties
5 Answers 60 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Frank
Top achievements
Rank 1
Frank asked on 12 Apr 2010, 07:55 AM

My Subscription datamodel class contains a SubscriberId with an association to a Person class containing a FullName property.
A grid defined like this works just fine - the FullName value is displayed in the grid correctly:

    Html.Telerik()  
        .Grid(Subscriptions)  
        .Name("MainGrid")  
        .Columns(columns => 
            {  
                columns.Bound(S => S.Person.FullName);  
                columns.Bound(S => S.SubjectClassType);  
                columns.Bound(S => S.SubjectName);  
            }  
        )  
        .Filterable()  
        .Pageable(paging => 
            paging.PageSize(10)  
            .Style(GridPagerStyles.NextPreviousAndNumeric)  
            .Position(GridPagerPosition.Bottom)  
        )  
        .Render();  
 
But when I try to group the grid items by s.Person.FullName, I get an exception that there is no SQL function to get the value.
        .Groupable(grouping => grouping.Groups(groups => 
        {  
            groups.Add(s => s.Person.FullName);  
            groups.Add(s => s.SubjectClassType);  
            groups.Add(s => s.SubjectName);  
        }))  
 
I can group by the SubscriberId, but I don't want to display a Guid in the grid. Is there a way to do what I'm trying to do?

Frank

5 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 12 Apr 2010, 08:00 AM
Hi Frank,

A similar scenario is shown in our ajax binding demo. We have a column bound to Customer.ContactName and I can group by it without a problem.

What exactly is the error message you are receiving?

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
Frank
Top achievements
Rank 1
answered on 12 Apr 2010, 08:48 PM
I tried using the code in the Ajax demo but I got a JavaScript error in jQuery 1.4.2 at a line which reads
j=a.length,
because a is undefined.
When I continued in the debugger I got an empty grid.
I am using the MVC1 version of the DLL.
I've also tried the 329 version with the same result.

0
Frank
Top achievements
Rank 1
answered on 13 Apr 2010, 07:24 AM

The exact error was
"The member 'FelixGO.Models.Person.FullName' has no supported translation to SQL." I can send the stack trace if necessary.

I am using server binding. 

If I replace the Person.FullName grouping item with SubscriberId, the grid is grouped correctly, but is completely expanded. When I click on the collapse gizmo, nothing happens.Is there a way to specify a completely collapsed grid?

Again, I am using the MVC1 version of the Telerik.MVC.dll.

<%    
    using (Html.BeginForm())  
    {  
 
        IEnumerable<EventSubscription> EventSubscriptions = ViewData["EventSubscriptions"] as IEnumerable<EventSubscription>;  
 
        Html.Telerik()  
            .Grid(EventSubscriptions)  
            .Name("MainGrid")  
            .Columns(columns => 
            {  
                columns.Bound(S => S.Person.FullName).Width(200);  
                columns.Bound(S => S.SubjectClassType).Width(200).Title("Refers To");  
                columns.Bound(S => S.SubjectName).Width(200).Title("Name");  
                columns.Bound(S => S.OnboardingActivityStatus.Name).Width(100).Title("Status");  
            }  
            )  
            .Groupable(grouping => grouping.Groups(groups => 
            {  
                groups.Add(s => s.Person.FullName);  
                groups.Add(s => s.SubjectClassType);  
                groups.Add(s => s.SubjectName);  
            }))  
            .Sortable(sorting => sorting.SortMode(GridSortMode.MultipleColumn))  
            .Filterable()  
            .Pageable(paging => 
                paging.PageSize(10)  
                .Style(GridPagerStyles.NextPreviousAndNumeric)  
                .Position(GridPagerPosition.Bottom)  
            )  
            .Render();  
    }  
%> 
 
0
Atanas Korchev
Telerik team
answered on 13 Apr 2010, 08:35 AM
Hello Frank,

Unfortunately I cannot help without seeing a project which shows the problem. You can host a runnable project somewhere where we can download it.

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
Morten Mertner
Top achievements
Rank 1
answered on 18 Apr 2010, 12:18 AM
I can really recommend to include this link when requesting samples from end users :-)
Tags
Grid
Asked by
Frank
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Frank
Top achievements
Rank 1
Morten Mertner
Top achievements
Rank 1
Share this question
or