更改剑道数字过滤器格式 [英] Changing the kendo numeric filter format

查看:56
本文介绍了更改剑道数字过滤器格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Kendo网格中应用自定义分页和排序.对于我的一栏,我得到了一个数字文本框.当我在数字文本框中插入值时,它是整数,但是当焦点从过滤器数字文本框中移开时,它将转换为十进制.例如:如果我输入32,它仍然是32,但是当焦点移开时,该值变为32.00.但我希望该值保持32.

I am applying custom paging and sorting in the kendo grid. For one of my column I am getting a numeric text box. When I insert the value in numeric text box it is integer, but as the focus is removed from the filter numeric text box it converts into decimal. For eg: if I entered 32, it remains 32,but as the focus is removed the value becomes 32.00. But I want that value to remains 32.

因此任何人都可以帮助我解决该问题.

So any one can please help me out with the solution.

推荐答案

您可以像下面这样设置

columns.Bound(x => x.Property).Filterable(x => x.UI("NumericFilter"));

<script type="text/javascript">
function NumericFilter(control) {
    $(control).kendoNumericTextBox({ "format": "n0", "decimals": 0 });

}
</script>

或 使用扩展方法

Or use extension method

columns.NumericColumn(x => x.Property);

public static GridBoundColumnBuilder<TModel> NumericColumn<TModel, TValue>(this GridColumnFactory<TModel> Column, Expression<Func<TModel, TValue>> Expression) where TModel : class
{
    return Column.Bound(Expression).Filterable(x => x.UI("NumericFilter"));

}

这篇关于更改剑道数字过滤器格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆