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

Bug: Grouping name does not honor MVC Attributes

3 Answers 84 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 29 Jun 2012, 08:37 PM
Given the following model:

    public class PropertyUnitModel
    {
        public Guid Id { get; set; }
 
        public Guid PropertyId { get; set; }
 
        public Guid FloorPlanId { get; set; }
 
        [Display(Name = "Floor Plan", Description = "Floor Plan", GroupName = "Floor Plan")]
        public string FloorPlanName { get; set; }
 
        public string UnitNumber { get; set; }
 
        [Display(Name = "SqFt")]
        public int SquareFootage { get; set; }
 
        public string Notes { get; set; }
}

And the following Grid definition:
@(Html.Kendo().Grid<PropertyUnitModel>()
    .Name("propertyUnitsGrid")
    .Columns(columns =>
        {
            columns.Bound(p => p.UnitNumber).Groupable(false).Width(100);
            columns.Bound(p => p.SquareFootage).Groupable(false).Width(70);
            columns.Bound(p => p.Notes).Groupable(false);
        })
    .Sortable()
    .Pageable(pager => pager.Refresh(true).PreviousNext(false).PageSizes(false).Input(false).Numeric(false))
    .DataSource(dataSource => dataSource
        .Ajax()
        .Group(groups => groups.Add(p => p.FloorPlanName))
        .Model(model => model.Id(p => p.Id))
        .Read(read => read.Action("GetAllByProperty", "PropertyUnits", new { PropertyId = Model.Id }))
    ))

I am getting the following Grid rendering:

I do not believe this is correct. The groups should read: Floor Plan: Plan 1 [1.0BR + 1.0BA] and Floor Plan: Plan 2 [2.0BR + 1.0BA].

I don't want the actual name of the field displayed, that's why I put in the [Display] attributes, which the column rendering honors. But since the DisplayAtribute has a GroupName property, the Grid should be honoring that first, then the Name if GroupName is not present, then if neither are present, the property name.

Thanks!

3 Answers, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 02 Jul 2012, 02:58 PM
Hi Robert,

I am afraid currently the described behavior is not supported - [Display] attributes is not taken into account. Although, this functionality sounds good and I will suggest to send it as a feature request at our UserVoice page. This way the community can evaluate it - the more votes it collects, the sooner it will be planned. 

Greetings,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Robert
Top achievements
Rank 1
answered on 02 Jul 2012, 03:48 PM
The fact that it is being taken into account for a property's display name, but *not* the property's group display name is a *bug*, not a feature request that should have to wait to be voted on. At the very least, it should be honoring the Name property of the Display attribute, like regular columns do. But the correct functionality would be to honor the GroupName property.

Other control vendors with groupable Grids honor this attribute this way, not sure why that means it should be considered a feature request.
0
Atanas Korchev
Telerik team
answered on 02 Jul 2012, 04:02 PM
Hello Robert,

 We don't consider this a bug - it is rather a missing feature. As with all feature request we are first adding them to our UserVoice page. We are implementing feature requests based on user interest.

Regards,
Atanas Korchev,
Kendo UI Technical Director

Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Robert
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Robert
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or