Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put the limit for numeric textbox in kendogrid column filter menu?

Here issue is in the kendogrid column menu filter is not having limit to filter i don't need the negative value .In second image while enter the arrow it's going negativeve values how to restrict the negative value?

enter image description here

like image 963
stpdevi Avatar asked Apr 30 '13 04:04

stpdevi


1 Answers

Use the filterMenuInit event of the grid. Then find the numeric textbox and set its min value to 0 using the min method. Here is a sample 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

like image 115
Atanas Korchev Avatar answered Sep 19 '22 14:09

Atanas Korchev