This question is locked. New answers and comments are not allowed.
William Brown
Top achievements
Rank 1
William Brown
asked on 02 Sep 2010, 01:20 AM
We have a grouped column:
But I want it sorted descending initially by PackageDate. Is that possible to set on the initial rendering in the ASPX? I tried adding a sortby that column descending, but it didn't work.
I click the group header column and it will sort the grouping descending and when I view the page source I see:
That's how I'd like the initial group to display. Any way to do this?
Thanks,
Bill
.Groupable(grouping => grouping.Enabled(Model.GridProperty.Grouping)).Groupable(grouping => grouping.Groups(groups => groups.Add(c => c.PackageDate)))But I want it sorted descending initially by PackageDate. Is that possible to set on the initial rendering in the ASPX? I tried adding a sortby that column descending, but it didn't work.
I click the group header column and it will sort the grouping descending and when I view the page source I see:
GridCasePreviousSubmissionList-groupBy=PackageDate-asc"><
That's how I'd like the initial group to display. Any way to do this?
Thanks,
Bill
13 Answers, 1 is accepted
0
Hello William Brown,
grouping.Groups(groups => groups.Add(c=> c.PackageDate, ListSortDirection.Descending)
Best wishes,
Atanas Korchev
the Telerik team
Unfortunately this is currently not possible. However you can easily implement it like this:
- Open GridGroupDescriptorFactory.cs
- Create a new overload of the Add method:
publicGridGroupDescriptorBuilder<TModel> Add<TValue>(Expression<Func<TModel, TValue>> expression, ListSortDirection sortDirection){GroupDescriptor descriptor =newGroupDescriptor();descriptor.Member = expression.MemberWithoutInstance();descriptor.SortDirection = sortDirection;descriptor.MemberType =typeof(TValue);settings.Groups.Add(descriptor);returnnewGridGroupDescriptorBuilder<TModel>(descriptor);}
grouping.Groups(groups => groups.Add(c=> c.PackageDate, ListSortDirection.Descending)
Best wishes,
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
William Brown
Top achievements
Rank 1
answered on 02 Sep 2010, 02:38 PM
Thanks Atanas,
Where do i find GridGroupDescriptorFactory.cs in the project? I see telerik.grid.grouping.min.cs but cannot see the file you mention. Thanks for your quick solution, I look forward to trying it out!
Bill
Where do i find GridGroupDescriptorFactory.cs in the project? I see telerik.grid.grouping.min.cs but cannot see the file you mention. Thanks for your quick solution, I look forward to trying it out!
Bill
0
Hello William Brown,
The file is in [install location]Source\Telerik.Web.Mvc\UI\Grid\Fluent\
All the best,
Atanas Korchev
the Telerik team
The file is in [install location]Source\Telerik.Web.Mvc\UI\Grid\Fluent\
All the best,
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
William Brown
Top achievements
Rank 1
answered on 02 Sep 2010, 03:40 PM
Thanks Atanas!
I installed manually under program files over our previous release. Once I make the change you suggest, how do I integrate it in my project? My project only references the telerik dll and includes the scripts folder and content styles. Do I need to rebuild the Telerik.Web.Mvc.dll?
Bill
I installed manually under program files over our previous release. Once I make the change you suggest, how do I integrate it in my project? My project only references the telerik dll and includes the scripts folder and content styles. Do I need to rebuild the Telerik.Web.Mvc.dll?
Bill
0
Hello William Brown,
Since this is a modification to the source code you need to rebuild the solution (make sure you have set the proper build configuration first) and then use the output assembly in your project.
Regards,
Atanas Korchev
the Telerik team
Since this is a modification to the source code you need to rebuild the solution (make sure you have set the proper build configuration first) and then use the output assembly in your project.
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
William Brown
Top achievements
Rank 1
answered on 03 Sep 2010, 12:06 AM
Hello Atanas,
See attached picture.
I tried modifying the code, but I"m not good w/ generics. I added the missing using clauses. The <TModel> is giving me issues and the settings. is giving me issues. Do I need to add a reference or is this supposed to be something else?
I tried changing it to "T" defined above, but it didn't know what settings.Groups.Add is.
Thanks for you help
See attached picture.
I tried modifying the code, but I"m not good w/ generics. I added the missing using clauses. The <TModel> is giving me issues and the settings. is giving me issues. Do I need to add a reference or is this supposed to be something else?
I tried changing it to "T" defined above, but it didn't know what settings.Groups.Add is.
Thanks for you help
0
Hi William Brown,
Atanas Korchev
the Telerik team
The screenshot shows that you are editing a different file. You should add the method in GridGroupDescriptorFactory.cs not in GridGroupDescriptorBuilder.cs.
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
William Brown
Top achievements
Rank 1
answered on 03 Sep 2010, 05:34 PM
Sorry, you are right! I clicked on the wrong class. after adding the new method, the build wont' compile with errors in ViewComponentFactory.cs - RangeAdapter cannot be found.
What references do I need or am I missing? Is there a help document on compiling the Telerik MVC dll itself? In the app I don't see missing references that are incorrect.
Bill
What references do I need or am I missing? Is there a help document on compiling the Telerik MVC dll itself? In the app I don't see missing references that are incorrect.
Bill
0
William Brown
Top achievements
Rank 1
answered on 03 Sep 2010, 05:36 PM
Is RangeAttributeAdapter a new mvc class? I can't seem to find it.
0
Hello William Brown,
Atanas Korchev
the Telerik team
You need to change the build configuration to Release MVC2 NET35.
All the best,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
William Brown
Top achievements
Rank 1
answered on 07 Sep 2010, 04:48 PM
Hi Atanas,
I do have settings set to Release MVC2 NET35 and get the error i describe. see attached picture of settings and errors when building on the bottom. if you can build this with the code inserted and just send me the dll I'd be happy for now for this customer. if not, let me know what i can do to get it built.
Thanks
Bill
I do have settings set to Release MVC2 NET35 and get the error i describe. see attached picture of settings and errors when building on the bottom. if you can build this with the code inserted and just send me the dll I'd be happy for now for this customer. if not, let me know what i can do to get it built.
Thanks
Bill
0
Accepted
Hi William Brown,
Regards,
Atanas Korchev
the Telerik team
That's odd. After changing the solution build configuration (not the project) I was able to build it successfully.
Anyway here is how to group by descendingly without modifying the source code:
<% var gridBuilder = Html.Telerik().Grid<Order>(Model) .Name("Grid") .Columns(columns => { columns.Bound(o => o.OrderID).Width(100); columns.Bound(o => o.Customer.ContactName).Width(200); columns.Bound(o => o.ShipAddress); columns.Bound(o => o.OrderDate).Format("{0:MM/dd/yyyy}").Width(120); }) .Groupable(settings => settings.Groups(groups => { groups.Add(o => o.OrderDate); })) .DataBinding(dataBinding => dataBinding.Ajax().Select("GroupingAjax", "Grid")) .Scrollable() .Sortable() .Pageable() .Filterable(); var grid = gridBuilder.ToComponent(); grid.Grouping.Groups[0].SortDirection = System.ComponentModel.ListSortDirection.Descending; gridBuilder.Render(); %>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
William Brown
Top achievements
Rank 1
answered on 07 Sep 2010, 06:26 PM
This works great and is better than recompiling the dll. thanks!