Unplanned
Last Updated: 10 May 2020 13:06 by Lee
Michael
Created on: 07 May 2020 18:18
Category: Grid
Type: Feature Request
3
Split field names for auto-generated columns by CapitalLetter

For example, I'd like something like this:
Field Name: record.TotalSales -> Auto-generated column title: "Total Sales" with inserted space

ADMIN EDIT: See also the idea below about "AutoGeneratedTitles" Func<string, string> property where the user could perform whatever processing they liked upon the default value. Please leave your comment on what approach you would prefer to be exposed.

6 comments
Lee
Posted on: 10 May 2020 13:06
Yeah I think if it's consistent with the AJAX suite (where I believe it does do this split if you use ModelBinding) that would help a lot.
ADMIN
Marin Bratanov
Posted on: 08 May 2020 13:06

Thank you for the idea, Michael, we will consider it. Providing an out-of-the-box solution for the most common case will be significantly easier to use, though, so I am not sure if a function call will be what happens. Let's see what the community thinks, though, maybe people will prefer it. I've edited the opener post to mention this.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Michael
Posted on: 08 May 2020 13:00
On second thought, rather than offer a single use case, add an "AutoGeneratedTitles" Func<string, string> property where the user could perform whatever processing they liked upon the default value.
ADMIN
Marin Bratanov
Posted on: 08 May 2020 08:09

Thank you for the idea, Jesse. This would work for columns you define explicitly in a grid, but the idea in the feature request is that the grid does this for the columns it generates automatically from the model - you can't set their Title like that because you don't have them in the markup.

 

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Jesse
Posted on: 07 May 2020 22:41

Michael,

 

I know you may want it built in to the Telerik UI, but why not use Humanizer: https://github.com/Humanizr/Humanizer

 

You would then be able to do something like

<AuthorizeView>
    <TelerikGrid Data=@GridData
                 @ref="@Grid"
                 Pageable="true"
                 Groupable="true"
                 Sortable="true"
                 FilterMode="GridFilterMode.FilterMenu"
                 Resizable="true"
                 Reorderable="false"
                 PageSize="20">
        <GridColumns>
            <GridColumn Field="@nameof(record.TotalSales).Humanize(LetterCase.Title)" />
            <GridColumn Field="@nameof(record.ReallyLongVariableName).Humanize(LetterCase.Sentence)" />
        </GridColumns>
    </TelerikGrid>
</AuthorizeView>
ADMIN
Marin Bratanov
Posted on: 07 May 2020 18:20

For the community benefit - for the time being the best option is to use the [Display(Name="The Desired Title")] data annotation attribute on the model: https://docs.telerik.com/blazor-ui/components/grid/columns/auto-generated#customization

If this does not become the default behavior, I imagine it would be exposed as a setting on the GridAutoGeneratedColumns tag.

Regards,
Marin Bratanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.