How to set a limit on a numeric text field in the kendogrid column filter menu?

Here the problem in the calendar menu of the kendogrid column has no filtering restriction, I don't need a negative value. In the second image, when you enter the arrow, it has negative values. How to limit the negative value?

enter image description here

+6
source share
1 answer

Use filterMenuInit grid event. Then find the numeric text field and set its min value to 0 using the min method. Here is an example implementation:

<div id="grid"></div> <script> $("#grid").kendoGrid({ dataSource:{ data: [ { name: "Jane Doe", age: 30 }, { name: "Jane Doe", age: 33 } ], schema: { model: { fields: { age: { type: "number" } } } } }, filterable: { extra: false }, filterMenuInit: function(e) { var numeric = e.container.find("[data-role=numerictextbox]").data("kendoNumericTextBox"); if (numeric) { numeric.min(0); } } }); </script> 

And a live demo: http://jsbin.com/itiwos/1/edit

+7
source

Source: https://habr.com/ru/post/943936/


All Articles