简体   繁体   English

无法覆盖Kendo Grid筛选器消息(ASP.NET MVC)

[英]Cannot override Kendo Grid filter messages (ASP.NET MVC)

I have Kendo Grid with filter message overriden (or at least I'd like to have one): 我有覆盖过滤器消息的Kendo Grid(或者至少我想拥有一个):

(...)
.Scrollable()
.Filterable(f => f.Messages(msg => msg.Clear("XXXXXXXX")))
.Sortable()
(...)

But after checking I can still see default message. 但检查后,我仍然可以看到默认消息。 So I tried to set it to columns: 所以我试图将其设置为列:

(...)
column.Bound(m => m.MyProperty).Filterable(f => f.Messages(msg => msg.Clear("XXXXXXXX")))
(...)

And it works perfectly fine! 而且效果很好! The message is overriden to "XXXXXXXX". 该消息被覆盖为“ XXXXXXXX”。

The generated JavaScript contains default filter messages definitions set on every column, so it's clear that custom messages set on grid are overriden by messages, that MVC Helper set on every column. 生成的JavaScript包含在每列上设置的默认过滤器消息定义,因此很显然,在网格上设置的自定义消息会被MVC Helper在每列上设置的消息覆盖。

Is there any way to set custom filter messages on grid with MVC helper? 有什么方法可以使用MVC助手在网格上设置自定义过滤器消息? I have tens of grids with hundreds of columns, so setting custom messages on every column just to change clear button text is not considered as an option (yet). 我有数十个带有数百个列的网格,因此,不考虑在每列上设置自定义消息只是为了更改清除按钮文本(尚未)。

I could create some simple script and attach it to FilterMenuOpen event but is there any simpler way? 我可以创建一些简单的脚本并将其附加到FilterMenuOpen事件,但是有没有更简单的方法? Without messing with Kendo's localization resources? 不会弄乱剑道的本地化资源吗?

Nearly 18 months later but in case anyone else stumbles upon this thread and needs the answer. 将近18个月后,但万一其他人偶然发现此线程并需要答案。

(...)
.Scrollable()
.Filterable(f => f.Messages(msg => msg.Info("XXXXXXXX")))
.Sortable()
(...)

The .Info method allows you to change the filter message for all columns. .Info方法允许您更改所有列的过滤器消息。 You can also set the message via each column's .Filterable() method. 您还可以通过每列的.Filterable()方法设置消息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM