gpt4 book ai didi

asp.net-mvc-3 - 使用 Razor 在 Telerik MVC3 网格中选择筛选器选项

转载 作者:行者123 更新时间:2023-12-03 04:08:40 36 4
gpt4 key购买 nike

我正在使用 Telerik MVC3 扩展,特别是 Grid,可以看到 here

我正在使用自定义分页,并对过滤选项感兴趣。

使用以下内容很容易过滤每列:

.Columns(x =>
{
x.Bound(col => col.Id).Filterable(false);

但是,当我启用它时,我似乎无法选择向用户呈现哪些选项。无论哪个字段,我都会在过滤器下拉列表中得到以下内容:

Filter Options

理想情况下我只想要“包含” - 这可能吗?

最佳答案

我的解决方案是这样的:

Telerik GRID代码:

columns.Bound(o => o.MRUCode).HeaderHtmlAttributes(new { @class = "FilterOnlyOn_Contains" });


JavaScript代码:

$(".FilterOnlyOn_Contains .t-filter").click(function () {
setTimeout(function () {
// Remove all existing options and add 'Contains'
var filterOptions1 = $(".t-filter-operator").first();
filterOptions1.empty();
filterOptions1.append($("<option />").val("substringof").text("Contains"));

// Remove second part (options + text + input)
var filterOptions2 = $(".t-filter-operator").last();
filterOptions2.hide();
$(".t-filter-help-text").text("");
$("input[type=text]").last().hide();
});
});


结果如下所示:
enter image description here

关于asp.net-mvc-3 - 使用 Razor 在 Telerik MVC3 网格中选择筛选器选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9027452/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com