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

How to set the Group By text

3 Answers 256 Views
Grid
This is a migrated thread and some comments may be shown as answers.
jon
Top achievements
Rank 1
jon asked on 30 Jul 2012, 03:00 AM
I am using a boolean field to add a grouping to a grid.  The field has been given the following model attributes

[Display(Name = "COMMON TASK")]
public bool CommonTask { get; set; }

If I INCLUDE the field property as a bound field, the grid is correctly displaying the group by text as "COMMON TASK".  But displaying the field BOTH as a group by and a bound field is doubling up.  So I only want to display the value as a group by.

So when i remove the bound column, the group by text reverts back to "CommonTask", which is the property name and discards the display name attribute.

Is there a way if explicitly setting the group by text or is this a bug with Kendo.

The fist image shows the correctly formatted group by text, BUT the field is included as a bound field and a group by field.
The second image shows the field only used as a group by within the datasource and the display attribute being ignored.

3 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 30 Jul 2012, 08:35 AM
Hi jon,

The behavior you have described is expected. As the groups are property of the DataSource there is no way the group descriptor to "know" there is some custom text associated with the field as title. However, when the groups are visualized within a Grid widget, the widget will check if there is a title attribute set  through the column settings and use this title instead of the field name when displaying the group information.

If you want the column to not be displayed, but its title attribute to be used when visualizing the group, you may set the column as hidden. 

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
jon
Top achievements
Rank 1
answered on 30 Jul 2012, 09:50 AM
Thanx Rosen, I should have mentioned that I tried that.  I not only included the column and set the visibility to false, but also tried to set its width to 0 but neither worked.  The visibility set to false also ignored the model attribute.

Should I submit a development suggestion for a "ClientTemplate" feature on the group by row.  This way i could explicitly set the text on the row.
0
Accepted
Rosen
Telerik team
answered on 30 Jul 2012, 11:32 AM
jon,

You should set the column as hidden (.Hidden(true)) instead of setting the Visible option to false. The later will not render the column at all, as opposite to the former, where the column will be rendered but hidden.

Also there is already a ClientGroupHeaderTemplate built-in.  

All the best,
Rosen
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
jon
Top achievements
Rank 1
Answers by
Rosen
Telerik team
jon
Top achievements
Rank 1
Share this question
or