10 Answers, 1 is accepted
Indeed the behavior you get is the expected one. Since Q3 2010 release a breaking change was that the Grouping and Grouped events now fire only when a grouping operation has been performed on the UI.
May you please share with us a little bit more details about your exact scenario? Thus we would be able to provide you with an appropriate solution.
Vanya Pavlova
the Telerik team
I have the exact same issue because the column I am grouping contains empty cells and hence after the grouping I end up with a group with no group name/header (it's empty string). Is there I can replace it with something like "Others" or "Empty" ?
I am putting the group descriptors programmatically.
Moreover, is there a way that I can place that group at the end of all the groups ?
You may predefine the GroupHeaderTemplate either at a grid level or at a column level. There you may implement your custom logic and using a single converter you may return whatever you need through examining the underlying property value, please refer to the following:
<
telerik:GridViewDataColumn.GroupHeaderTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding Group.Key,Converter={StaticResource converter}}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.GroupHeaderTemplate
>
Since you are adding the GroupDescriptors in code behind you need to ensure that the ColumnGroupDescriptor associated with this column is added last to RadGridView's descriptors, you may read more about this here.
Vanya Pavlova
the Telerik team
Is there a way that
this text can be replaced either before the sorting of the group headers
OR
a sorting with the replaced text can be triggered afterwards
OR
to manually place this group header at the end of all the group headers ?
I believe that the following forum thread would be useful for you on that matter.
Please let me know how this corresponds in your custom scenario.
Vanya Pavlova
the Telerik team
Other than the ways I asked for that could be used to do this in the last post, another way this can be done is if I or the developer can specify my own sorting function that is used for sorting the group headers. Suggestions ?
As my colleague Tsvyatko suggested in the previously referenced thread, you may define sort direction for the current group descriptor using its SortDirection property. In addition to this in case you need to move the null values at the bottom, you have to combine custom property approach with using the converter - the property value will affect the position of the group while converter will take care of the display value. Both of these approaches are applicable in this case. In order to avoid any further misunderstandings you may attach some shapshot that would give us a little bit more information about the desired final result.
Vanya Pavlova
the Telerik team
Please note that even after the converter is used the string "Others" just stays at the position where the null value would have been. At the moment we need to know a way to push this value at the bottom of this list.
Thank you for sharing these pictures to us!
I believe that there is something custom in your project and it would be great if you can send us a small application in a new support ticket which we can test locally.
Vanya Pavlova
the Telerik team
..."you may define sort direction for the current group descriptor using its SortDirection property. In addition to this in case you need to move the null values at the bottom, you have to combine custom property approach with using the converter - the property value will affect the position of the group while converter will take care of the display value."...
So before applying the converter, an empty value (which is the fallback value for a null) is shown at the top. Moreover since an ascending grouping is applied on the group you see all items sorted in ascending order as well. When the converter is executed it just replaces the text which is null to something else. The converter does nothing to change the position of the group header in the list of group headers.
Are you suggesting I apply some other converter in some other way ?