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

How to do CLIENT side grouping/sorting/filtering by clicking on the header column

4 Answers 168 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Edward Pauley
Top achievements
Rank 1
Edward Pauley asked on 21 Mar 2011, 10:20 PM
Hi
I am using Entity Framework 4 and RIA service  to retrieving the data from the database and transfer it to client

after using the newest release version of RadGridView Q1 2011, i do know that the current version will make all of the Sorting/Grouping/Filtering through SERVER side by clicking on the corresponding column header.

However, i have a problem with that because my collection has some EXTRA properties which have been created on the fly during retrieving data from the database , and then that collection will be bounded to the itemsSource of RadGridView

For example, I have a table Order with the fields:
        OrderId, CustomerId, Description
                    (foreign key to Customer table)
because our Customer table will have thousand of records and we don't really want to show the CustomerId but instead we want to show the CustomerName on the radGridView (using GridViewComboxColumn isn't a solution because of large data). In order to be able to accomplish that, I have created an extra property CustomerName for the Order object

-now the Order object will have the fields  (BUT IN THE DATABASE, it will only have OrderId, CustomerId, Description) 
        OrderId, CustomerId, CustomerName, Description
                                           (corresponding to the CustomerId)
And now i encounter the problem of sorting/grouping/filtering for the CustomerName on the radgridview. Whenever i click on the CustomerName to do the sorting/grouping/filtering, it will always fail because that's customerName not really existing in the database ORDER table (due to default server-side sorting/grouping/filtering)


1. By doing further research in the forum, i find out that i can use the SortMemberPath/GroupMemberPath. So for the CustomerName column , i set SortMemberPath/GroupMemberPath to CustomerId in order to fix the issue. It works PARTLY. What i mean is that, if i do the grouping , then the groupLable will show CUSTOMERID (but i want it to show CUSTOMERNAME) for each group.

--->The best solution i can think of how to fix my current problem is to change the default sorting/grouping/filtering to CLIENT side (instead of Server side). With that i think that might fix my current problem. But i don't know how to set that???

---> Or override the sorting/grouping/filtering to let it work with CustomerName on the serverside but how ???

plz help me. Any sample code or articles will be appreciated

thanks

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 22 Mar 2011, 08:05 AM
Hello,

 The grid will sort, group, filter, etc. server-side only when you bind RadGridView to DomainDataSource/RadDomainDataSource. In all other situations the grid will perform these operations in-memory. 

Best wishes,
Vlad
the Telerik team
0
Edward Pauley
Top achievements
Rank 1
answered on 22 Mar 2011, 09:04 AM
Hi

because i am using RadDomainDataSource in order to retrieving the data from the server, can you suggest me a solution in order to fix my current problem with the extra property for grouping/sorting/filtering?

when i click on the column header, the radgridview must have added some OrderBy statement LINQ and send that LINQ to the server to retrieving the data. The same situation for grouping. However, because that extra property doesn't exist in the database , it produces error. 

are there any ways to override it?

thanks
0
Vlad
Telerik team
answered on 22 Mar 2011, 09:07 AM
Hi,

 If you bind the grid directly to the context without RadDomainDataSource you will not have such problem. 

Kind regards,
Vlad
the Telerik team
0
Edward Pauley
Top achievements
Rank 1
answered on 22 Mar 2011, 09:04 PM
Hi

what you mean is that :

-In order to have client-side sorting/grouping/filtering, i should have use DomainContext (without domaindatasource binding), call a service
and when the service is completed, then i will bind the returned collection of the service to the itemsSource of the radgridview instead??

if i do like that, how am i supposed to apply for the Paging by using RadDataPager

Right now i am using RadDomainDataSource because i can take the advantage of the combination RadDataPager

any advises?

thanks
Tags
GridView
Asked by
Edward Pauley
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Edward Pauley
Top achievements
Rank 1
Share this question
or