gpt4 book ai didi

kendo-ui - MVC中的KENDOUI网格: Is there a way to hide filters on some columns?

转载 作者:行者123 更新时间:2023-12-04 09:41:15 25 4
gpt4 key购买 nike

我在MVC.NET中使用KENDO UI网格。

网格配置为显示每个列的列过滤器。

但是,我的某些列不可过滤,因此我想隐藏过滤器。

有没有一种方法可以从C#端进行配置? (不使用CSS或JS)。

最佳答案

在您的代码中,您可能会有类似以下内容:

<asp:Content ContentPlaceHolderID="MainContent" runat="server">
<%: Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.ProductID).Groupable(false);
columns.Bound(p => p.ProductName);
columns.Bound(p => p.UnitPrice);
columns.Bound(p => p.UnitsInStock);
})
.Groupable()
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Products_Read", "Grid"))
)
%>
</asp:Content>

如果希望 ProductID列不可过滤,则应说:
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
<%: Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.ProductID).Groupable(false).Filterable(false);
columns.Bound(p => p.ProductName);
columns.Bound(p => p.UnitPrice);
columns.Bound(p => p.UnitsInStock);
})
.Groupable()
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Products_Read", "Grid"))
)
%>
</asp:Content>

关于kendo-ui - MVC中的KENDOUI网格: Is there a way to hide filters on some columns?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14223280/

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