I am looking at using the Telerik MVC3 Razor grid control for a project.
Grouping works really well, but is it possible to remove the “column name: ” from the grouping?
e.g.
"Product Size: Large"
"Product Size: Small"
"Product Size: Medium"
change to
"Large"
"Small"
"Medium"
If I add a GroupHeaderTemplate to the Column(c=>c…) then I can get the text to say whatever I want…but then the same column is also displayed later on in my grid (after the grouping columns)
@(Html.Telerik().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(c => c.SheetLine).Visible(false)
.Aggregate(a => a.Count())
.GroupHeaderTemplate(@<text>@item.Key (@item.Count)</text>);
columns.Bound(c => c.VSACode);
columns.Bound(c => c.Bucket100)
.Title("First");
})
.Groupable(groupable => groupable.Groups(group =>
{
group.Add(g => g.SheetLine);
group.Add(g => g.PrintLine);
group.Add(g => g.SelectionLine);
}).Visible(false))
)
displays

and
@(Html.Telerik().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(c => c.SheetLine)
.Aggregate(a => a.Count())
.GroupHeaderTemplate(@<text>@item.Key</text>);
columns.Bound(c => c.VSACode);
columns.Bound(c => c.Bucket100)
.Title("First");
})
.Groupable(groupable => groupable.Groups(group =>
{
group.Add(g => g.SheetLine);
group.Add(g => g.PrintLine);
group.Add(g => g.SelectionLine);
}).Visible(false))
)
displays

But I can’t find the middle ground to get rid of that second “SheetLine” so it is only a grouped column AND has a groupheadertemplate.
Looks like the following issue which has been reported on the Telerik support forums here:
http://www.telerik.com/community/forums/aspnet-mvc/grid/custom-label-for-group.aspx
Currently there is no way to configure this, but you can make the column on which you group hidden (Hidden()). Just make sure that you place that column last in the list to support IE.
So basically you have to implement a solution that places the columns on which you group last in the list of defined columns for the grid and then you have to hide them (Hidden()…not Visible(false)!).