stpdevi
stpdevi

Reputation: 1114

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

Upvotes: 7

Views: 4612

Answers (1)

Atanas Korchev
Atanas Korchev

Reputation: 30671

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

Upvotes: 8

Related Questions