Changing the kendo numeric filter format

后端 未结 8 1621
孤街浪徒
孤街浪徒 2021-02-09 12:16

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 a

相关标签:
8条回答
  • 2021-02-09 13:00

    What Palani Kumar has said still inserts separators, that is it converts 12345 to 12,345; so i recommend the following edited code in case you want pure numbers without any formatting (no separators, no decimal points etc.).

    columns.Bound(x => x.Property).Filterable(x => x.UI("numericFilter"));
    
    <script type="text/javascript">
        function numericFilter(control) {
            $(control).kendoNumericTextBox({ format: "#", decimals: 0 });
    
        }
    </script> 
    
    0 讨论(0)
  • 2021-02-09 13:02

    You can set format on the filterable on the column like this:

                field: "TaskId",
                title: "TaskId",
                width: 80,
                filterable: {
                    ui: function (element) {
                        element.kendoNumericTextBox({
                            format: "n0"
                        });
                    }
                }
    

    Update This is the javascript version. here my complete grid defintion:

          $("#uxRunningTasksGrid").kendoGrid({
            dataSource: runningTasksDataSource,
            height: $(document).height() - 280,
            autoBind: true,
            filterable: true,
            sortable: true,
            pageable: false,
            reorderable: true,
            resizable: true,
            columns: [{
                command: { text: "Details", click: openDetails }, title: " ", width: 80
            },
                {
                    field: "TaskId",
                    title: "TaskId",
                    width: 80,
                    filterable: {
                        ui: function (element) {
                            element.kendoNumericTextBox({
                                format: "n0"
                            });
                        }
                    }
                }
            ]
         };
    
    0 讨论(0)
提交回复
热议问题