Kendo ui 布尔型剑道用户界面过滤器
是否可以有一个带有选项(如是、否、其他)的筛选菜单 我有一个带列的网格,它只能有3个值Yes、No或Other。过滤器应显示带有这些值的单选按钮以及两个按钮过滤器和清除。这可能吗 当我尝试使用字段类型:boolean时,我会得到“Yes”和“No”,但如何添加第三个单选按钮“Other” 任何帮助都将不胜感激Kendo ui 布尔型剑道用户界面过滤器,kendo-ui,Kendo Ui,是否可以有一个带有选项(如是、否、其他)的筛选菜单 我有一个带列的网格,它只能有3个值Yes、No或Other。过滤器应显示带有这些值的单选按钮以及两个按钮过滤器和清除。这可能吗 当我尝试使用字段类型:boolean时,我会得到“Yes”和“No”,但如何添加第三个单选按钮“Other” 任何帮助都将不胜感激 谢谢剑道在这里有一个如何做到这一点的例子: 下面是一个可能如何设置过滤器的示例 filterable: { //hide second filter option extra:
谢谢剑道在这里有一个如何做到这一点的例子: 下面是一个可能如何设置过滤器的示例
filterable: {
//hide second filter option
extra: false,
operators: {
string: {
eq: "Is equal to"
}
}
},
filterMenuInit: function(e) {
//when the filter menu opens find the first dropdown and hide it
//as it has the Is equal to filter in it.
e.container.find(".k-dropdown").eq(0).hide();
}
下面是JSbin,它展示了如何使用其中一些功能:
使现代化
虽然我可以让单选按钮显示在过滤器窗口中,但装配它是一件令人头痛的事情,而且默认剑道的东西非常粗糙。我建议使用演示中显示的剑道下拉列表,或者只是在网格本身的数据源上操作过滤器
可以使用如下代码完成:
$(".k-grid").data("kendoGrid").dataSource.filter({filters: [{field: "City", operator: "eq", value: "Boston"}], Logic: "and"})
下面是一个如何使用它的示例
filterMenuInit: function(e) {
//when filter menu opens toss it cause its lame!
e.container.html("
<input name='radio' type='radio' checked='checked' value='Clear'>Clear</input>
<input name='radio' type='radio' value='London'>London</input>
<input name='radio' type='radio' value='Seattle'>Seattle</input>
");
$("input[type=radio]").click(function(){
if($(this).val() != "Clear") {
$(".k-grid").data("kendoGrid").dataSource.filter({filters: [{field: "City", operator: "eq", value: $(this).val()}], Logic: "and"})
}else {
$(".k-grid").data("kendoGrid").dataSource.filter({})
}
});
}
以及更新的JSbin:感谢您的回复。我使用的是v2012.2.710版本,不是最新版本。这段代码显示了如何隐藏dropdownlist,但是如何添加三个单选按钮yes,no,其他带有filter和clear按钮?我希望这能回答您的问题。