This question is locked. New answers and comments are not allowed.
Hello,
I was wondering if I can create a custom client side grouping on RadGridView ?
I have a grid with a column binded to my database to the "Date" column of my table value with a DomainDataSource.
I use a RadDataPager to show only 50 rows
When I use the group fonctionnality of the grid, it work but one group header was created for one line because my datas are spaced a few seconds.
I want to group by day or hour
I saw that the domain data source just do a "order by" server side and I think I can manage the group fonctionnality just in client side
How to do this please ?
Bye
JC
I was wondering if I can create a custom client side grouping on RadGridView ?
I have a grid with a column binded to my database to the "Date" column of my table value with a DomainDataSource.
I use a RadDataPager to show only 50 rows
When I use the group fonctionnality of the grid, it work but one group header was created for one line because my datas are spaced a few seconds.
I want to group by day or hour
I saw that the domain data source just do a "order by" server side and I think I can manage the group fonctionnality just in client side
How to do this please ?
Bye
JC
7 Answers, 1 is accepted
0
Hello JC,
You can try setting the GroupMemberPath property of your column to something like "MyDateTimeProperty.Date". Date is a property of DateTime that returns only the date part, and not the time.
Regards,
Yavor Georgiev
the Telerik team
You can try setting the GroupMemberPath property of your column to something like "MyDateTimeProperty.Date". Date is a property of DateTime that returns only the date part, and not the time.
Regards,
Yavor Georgiev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
JC
Top achievements
Rank 1
answered on 13 Dec 2010, 02:13 PM
Hello,
Thanks for you reply, but you can't do this because the "GroupMembrePath" is used to create the query "order by" in the serveur side and linq to sql don't know the "Date" propoerty of date time, you obtain :
Another idea ?
Thanks for you reply, but you can't do this because the "GroupMembrePath" is used to create the query "order by" in the serveur side and linq to sql don't know the "Date" propoerty of date time, you obtain :
The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.Another idea ?
0
Hi JC,
You can try using Linq to SQL for your domain service. It should support this method.
Best wishes,
Yavor Georgiev
the Telerik team
You can try using Linq to SQL for your domain service. It should support this method.
Best wishes,
Yavor Georgiev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
JC
Top achievements
Rank 1
answered on 13 Dec 2010, 03:02 PM
Hi,
I can't change to LinqToSql and I think that no version of Linq support the "Date" property of DateTime
The first idea you want to do is :
It's work only if you get the table in memory and also use "Linq to objects" :
But with this solution, you do a "Select * from MyTable" ... bad !
Two way to do a good query :
or :
This reflects the fact that Linq transpose the C# "d.Date.Year" to the SQL "YEAR(Date)" etc ... but it can't interpret "D.Date" in SQL ...
So, when you group on RadGrid, DomainDataSource launch a "order" by on "Date" to get the good result depending the DataPager.
When the result comes, I search a way to override the client side grouping to change group descriptor !
Can you give me an entry point to do this ? When grid create GridViewGroupRow perhaps ?
Thanks !
JC
I can't change to LinqToSql and I think that no version of Linq support the "Date" property of DateTime
The first idea you want to do is :
MyTable.GroupBy(d => d.Date.Date)MyTable.ToList().GroupBy(d => d.Date.Date)Two way to do a good query :
MyTable.Where(da => da.Date.Year == day.Year).Where(da => da.Date.Month == day.Month).Where(da => da.Date.Day == day.Day);MyTable.GroupBy(d => new { Year = d.Date.Year, Month = d.Date.Month, Day = d.Date.Day })This reflects the fact that Linq transpose the C# "d.Date.Year" to the SQL "YEAR(Date)" etc ... but it can't interpret "D.Date" in SQL ...
So, when you group on RadGrid, DomainDataSource launch a "order" by on "Date" to get the good result depending the DataPager.
When the result comes, I search a way to override the client side grouping to change group descriptor !
Can you give me an entry point to do this ? When grid create GridViewGroupRow perhaps ?
Thanks !
JC
0
Hi JC,
I've researched several ways to try and make this work out of the box with as few tweaks as possible, but so far I have been unsuccessful. You will need to implement the IGroupDescriptor interface on your own and return the correct LINQ expression that the domain data source will understand.
Or, you can use the generic GroupDescriptor<> class, which makes using custom expressions easier. You can read more about those on my blog here.
Best wishes,
Yavor Georgiev
the Telerik team
I've researched several ways to try and make this work out of the box with as few tweaks as possible, but so far I have been unsuccessful. You will need to implement the IGroupDescriptor interface on your own and return the correct LINQ expression that the domain data source will understand.
Or, you can use the generic GroupDescriptor<> class, which makes using custom expressions easier. You can read more about those on my blog here.
Best wishes,
Yavor Georgiev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
JC
Top achievements
Rank 1
answered on 16 Dec 2010, 04:57 PM
Ok, bad news :(
I don't undertand how use GroupDescriptor ... do you have other documentation or good practice link ?
Why 3 parameters on the generic class ?
What I try to do is rather frequent, could you work on to create an exemple for community ?
Thanks also a lot for your research !!
JC
I don't undertand how use GroupDescriptor ... do you have other documentation or good practice link ?
Why 3 parameters on the generic class ?
What I try to do is rather frequent, could you work on to create an exemple for community ?
Thanks also a lot for your research !!
JC
0
Hi JC,
The third generic argument is the return type of the lambda used for sorting the groups. Unless you set the GroupSortingExpression property, you can supply any argument you wish.
Kind regards,
Yavor Georgiev
the Telerik team
The third generic argument is the return type of the lambda used for sorting the groups. Unless you set the GroupSortingExpression property, you can supply any argument you wish.
Kind regards,
Yavor Georgiev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight