Set default format for all Dates in a grid

4 posts, 0 answers
  1. Noah
    Noah avatar
    3 posts
    Member since:
    Mar 2020

    Posted 08 Apr 2020 Link to this post

    Hi, we are able to set the format for a date column using column binding such as follows: 

    c.Bound(col => col.Created).Title("Date").Format("{0: yyyy-MM-dd HH:mm:ss UTC}");

     

     

    Is there a way to dictate formatting at the grid level so that all grid columns receive the format and we don't have to repeat the format string for each column? This would be especially useful for us because we extract our default grid settings to an extension method, so we would be able to dictate the default format for all columns for all grids in one place.

  2. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2132 posts

    Posted 09 Apr 2020 Link to this post

    Hello Noah,

    The Grid can have columns bound to fields of different types: boolean, date, string, etc., for that reason there is no configuration option dedicated to setting the format of all columns, because that format won't be applicable to all data types. Column format is applied per column only.

    Regards,
    Ivan Danchev
    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.
  3. Noah
    Noah avatar
    3 posts
    Member since:
    Mar 2020

    Posted 09 Apr 2020 in reply to Ivan Danchev Link to this post

    Okay, we will make due. For the record, I was hoping for type-specific options like the ones found on the Fitlerable options. For example:

    .Filterable(filterable =>
        {
            filterable.Extra(false);
            filterable.Operators(o =>
            {
                o.ForString(str => str.Clear().Contains("Contains").IsEqualTo("Is equal to"));
                o.ForEnums(en => en.Clear().IsEqualTo("Is equal to"));
            });
        });
  4. Ivan Danchev
    Admin
    Ivan Danchev avatar
    2132 posts

    Posted 13 Apr 2020 Link to this post

    Noah,

    This is a valid suggestion. Consider adding it as a feature request in the Feedback Portal: https://feedback.telerik.com/aspnet-mvc

    Regards,
    Ivan Danchev
    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.
Back to Top