Kendo UI网格过滤器asp.net更改日期格式

时间:2016-04-27 08:31:27

标签: asp.net-mvc kendo-ui grid

如何更改剑道网格过滤器forDate中的Dateformat?

实际上,我有一个FilterableOperatorsBuilder ForDate,但我不知道如何解决这个问题。我总是在过滤日期选择器中获得01/04/2016作为日期,但我需要2016-04-01。

这是我迄今为止所得到的:

 public static Action<GridFilterableSettingsBuilder> FilterSettings()
    {
        Action<GridFilterableSettingsBuilder> configurator = ftb =>
        {
            ftb.Mode(GridFilterMode.Menu);
            ftb.Extra(false).Operators(o => o.ForString(str => str
                    .Clear()
                    .Contains("Contains")
                    .IsEqualTo("Is equal to")
                    .IsNotEqualTo("Is not equal to")
                    .StartsWith("Starts with")
                    .EndsWith("Ends with")));

            ftb.Extra(false).Operators(o => o.ForDate(
          --->> I think ii need to change the date format right here?
         ));
        };

        return configurator;
    }

如果有人能给我一个提示,那就太好了。

1 个答案:

答案 0 :(得分:1)

好的,最后,有一个非常简单的解决方案:

我刚刚添加了

 .Format("{0:yyyy-MM-dd hh:mm:ss tt}").Filterable(f => f.UI("DateTimeFilter"))

这很好,即使它可能不是完美的解决方案。如果有人有更好的,请告诉我。

相关问题