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

Grouping not work when using custom binding

13 Answers 248 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.
Nour Jbour
Top achievements
Rank 1
Nour Jbour asked on 31 Aug 2010, 01:21 AM
Hi,

I am using version 2010.2.825.235 and I facing grouping issue: 
 when I use the ajax binding, and when I drag/drop column to group by then everything work fine. but when using the custome binding and when I drag/drop a column to group by then it not work. 
what happened is a new column added to the left with empty header  and the grid columns without the header is shifted to the left.
so, if you have a grid with 2 columns and you want to group with column one. then a new column added ( the total is 3 now headers with two columns shifted to the left)

Regards,
Nour Jbour

13 Answers, 1 is accepted

Sort by
0
Mirosław Pragłowski
Top achievements
Rank 1
answered on 02 Sep 2010, 02:14 PM
Hi,
Have you solved the problem ? It seems I have the same effect :(

Mirosław Pragłowski
0
Nour Jbour
Top achievements
Rank 1
answered on 02 Sep 2010, 11:14 PM
Hi,

Not yet, it blocking us, we trying to solve it. 

The strange is that the telerik team not response to us.

I will do share once i found the problem, 

Regards,
Nour Jbour
0
Beedoo
Top achievements
Rank 1
answered on 05 Oct 2010, 10:56 AM
Hi,

I've the same problem while using grouping and custom binding. After looking the source code in Reflector, I think that it's not possible to use both custom binding and group functions.

Actually, when setting the EnableCustomBinding property to true on the grid, the DataProcessor does not process the data source. Because the only way to pass the source to the grid is by a IEnumerable<TEntity> it's impossible to pass a IQueryable<IGrouping<T>> that is attempted by the grid to generate groups...

Why the grid does not take car about the Grouping property and it's Groups collection when generating the UI in a custom binding way ?

Thanks for your response.

Regards,
Julien CORIOLAND
0
Nour Jbour
Top achievements
Rank 1
answered on 05 Oct 2010, 11:30 AM
Hi Julien,

The problem is solved and the solution was in the grid datasource structure. it should be grouped before sending it to the grid:
note that the below "Sort" "Where" and "GroupBy" extenstion are a telerik extensions and i put them all to show you a sample that apply filtering, sorting, grouping.

    var items = from item in Items
                                select new MyRowViewData()
                                {
                                    Id = item.Id;
                                    Name = item.Name,
                                    Type = item.Type
                                };
 
                    var jsonGroupedData = new
                    {
                        Total = items.TotalItemCount,
                        Data = items.AsQueryable().Sort(/* telerik sort from request*/).Where(/* telerick filter from request*/).GroupBy(/*telerik grouping from request*/)
                    };

                return Json(jsonGroupedData);
I am using above a direct json response. you may send a strong type list.

let me know if you need a working sample so I can made small on for you.

Hope this help.

Regards,

Nour Jbour
0
Rosen
Telerik team
answered on 07 Oct 2010, 01:28 PM
Hello Julien,

I'm afraid that current version of our grid extension does not support custom grouping when populated through server binding. However I'm happy to inform you that we have managed to address this limitation and this scenario will be supported with the next internal build. I have attached a small sample which demonstrates a possible implementation.

All the best,
Rosen
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
Beedoo
Top achievements
Rank 1
answered on 11 Oct 2010, 09:17 AM
Hello Rosen,


Thank you for taking the time to write a sample. I'll try to apply it today on our solution but I think it'll help me to solve my problem.




A solution to enable real custom binding scenarios server side may be to make the DataProcessor accessible when the EnableCustomBinding is set to true. Actually, I've found a workaround using reflection but it's very ugly.

I set manually three private fields of the grid :
  • dataSourceIsProcessed => true
  • processedDataSource => my processed datasource (AsQueryable)
  • totalCount => the item's count for pagination


Is it any way that the properties of the grid’s DataProcessor will be writeable in a custom binding context in the next release?

Thanks for the help


Regards,

Julien CORIOLAND

0
Rosen
Telerik team
answered on 11 Oct 2010, 10:13 AM
Hello Julien,

I'm afraid that incorporating the suggested modification is not possible. As those properties are responsible for DataProcessor's internal state, exposing them in such a way will be inappropriate and may result in  unexpected side effects. 

Also please note that when CustomBinding option is enabled, the supplied data source internally is assign to processedDataSource without any modifications made to it and the totalCount's value is retrieved from value set through GridPagingSettings' Total property. For more information on Grid's Custom binding please refer to this help article.

All the best,
Rosen
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
Sébastien
Top achievements
Rank 1
answered on 25 Oct 2010, 02:23 PM
Rosen,
Do you have a Visual Studio 2008 version please ? I can't open this version
Thanks
0
Wai Kei
Top achievements
Rank 1
answered on 28 Apr 2011, 02:40 AM
This sample app (telerikmvcapplication3.zip) works great. I am able to set up the grid with grouping using the custom ajax binding with sorting and paging by following the example.

However, it seems that I am having some problems in getting the header and the footer to show up. Whenever I added an aggregate using a ClientGroupFooter or ClientFooter, it is giving me an error:

"You cannot use non generic BindTo overload without EnableCustomBinding set to true"

But I did enable the custom binding. So I am not sure what's going on. Here is the column that I want to perform the aggregate:

columns.Bound(fs => fs.AuthorName).Width(125).Aggregate(agg => agg.Count().Max().Min()).ClientFooterTemplate(

 

"<#= Count #>");

 



Any ideas? Thank you.
0
Rosen
Telerik team
answered on 28 Apr 2011, 12:09 PM
Hello Wai Kei,

The error you are experiencing is caused by the fact that aggregates are not fully supported in this scenario. However, we have managed to address the error in question and the fix will be included in the next internal build.

Regards,
Rosen
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
Luis
Top achievements
Rank 1
answered on 07 Jan 2012, 04:05 PM
Finally I got it!

With the help of the guys on this thread I'm proud to say that I came to a satisfactory result, pluggable in any type of MVC application without much difficulty and almost none in the settings.

I published the project on Bitbucket and Nuget, please take a look and send me some feedbacks.

https://bitbucket.org/Lunadie/telerikmvcgridcustombindinghelper/wiki/Home 

https://nuget.org/packages/TelerikMvcGridCustomBindingHelper  
0
Prasanna
Top achievements
Rank 1
answered on 13 Feb 2012, 06:56 AM
Hello,

I tried with this sample application.
But in case of binding data .
It returns with exception " cannot bind null value while returning IEnumerable ".
Please help me out.
I want to implement an application which uses entity framework and grid which uses custom paging functionality.

0
Luis
Top achievements
Rank 1
answered on 13 Feb 2012, 05:22 PM
Prasanna, have you tested my project? I believe it can help you.
Tags
Grid
Asked by
Nour Jbour
Top achievements
Rank 1
Answers by
Mirosław Pragłowski
Top achievements
Rank 1
Nour Jbour
Top achievements
Rank 1
Beedoo
Top achievements
Rank 1
Rosen
Telerik team
Sébastien
Top achievements
Rank 1
Wai Kei
Top achievements
Rank 1
Luis
Top achievements
Rank 1
Prasanna
Top achievements
Rank 1
Share this question
or