Bug: Grouping name does not honor MVC Attributes

4 posts, 0 answers
  1. Robert
    Robert avatar
    38 posts
    Member since:
    Feb 2012

    Posted 29 Jun 2012 Link to this post

    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!
  2. Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 02 Jul 2012 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Robert
    Robert avatar
    38 posts
    Member since:
    Feb 2012

    Posted 02 Jul 2012 Link to this post

    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.
  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 02 Jul 2012 Link to this post

    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!
Back to Top
UI for ASP.NET MVC is VS 2017 Ready