首页 > 解决方案 > 剑道ui删除数字过滤器微调器

问题描述

我有这个过滤器字段,带有增加或减少数字的箭头,我想删除它们 在此处输入图像描述

到目前为止,我已经尝试了几种没有帮助的解决方案

{
                field: "TotalEnergyCharge",
                title: "Calc Total",
                format: "{0:n2}",
                width: "70px",
                headerAttributes: {
                    style: "overflow: visible; white-space: normal; text-align: center; font-weight: bold"
                },
                attributes: {
                    style: "text-align: right"
                },
                operator: "eq",
                filterable: {
                    cell: {
                        operator: "eq",
                        showOperators: false
                    }
                },
                spinners: false,
                editor: function (container, options) {
                        $('<input data-bind="value:' + options.field + '"/>')
                            .appendTo(container)
                            .kendoNumericTextBox({
                                spinners: false
                            });
                    }
            },

标签: javascriptkendo-uikendo-gridkendo-asp.net-mvc

解决方案


您无法删除,因为您尝试的两种方式都意味着以不同的方式工作。spinners之前editor根本不起作用,并且spinners位于内部的小部件的选项仅editor在用户编辑一行时才起作用。

现在,对于过滤器小部件,我找不到任何可以直接使用的东西,例如editor. 过滤器似乎没有类似的东西。

所以我在网格初始化后做了一个技巧,改变了过滤器的字段选项:

$('#grid .k-filter-row input[data-role="numerictextbox"]').each((i, el) => {
    $(el).data('kendoNumericTextBox').setOptions({ spinners: false });
});

道场

修改选择器以获取您想要删除微调器的过滤器。

请注意,setOptions在 NumericTextBox 文档中未将其列为方法。为剑道点赞!!


推荐阅读