Ginwu Ginwu - 7 months ago 84
Javascript Question

kendo ui grid filter doesn't work for integer type columns

I have a problem with Kendo UI. I can't filter on some columns.

Here's a plunker with my example where I try to filter on the columns id, prog or Max Temps and it doesn't work.

<body>
<div id="grid"></div>
</body>
<script>
$("#grid").kendoGrid({
dataSource: [
{ id: 36308, reportDate: "2015-02-01", prog: 58, state: "Waiting", maxTemps: 0 },
{ id: 36309, reportDate: "2015-02-01", prog: 34, state: "Complete", maxTemps: 86400 },
{ id: 36310, reportDate: "2015-02-01", prog: 116, state: "Complete", maxTemps: 86400 },
{ id: 36311, reportDate: "2015-02-02", prog: 58, state: "Complete", maxTemps: 86400 }
],
filterable: true,
columnMenu: true,
columns: [
{ field: 'id', title: 'Id', width: '80px' },
{ field: 'reportDate', title: 'Report Date', width: '100px' },
{ field: 'prog', title: 'Prog', width: '60px' },
{ field: 'state', title: 'Status', width: '130px' },
{ field: 'maxTemps', title: 'Max Temps', width: '100px' }
]
});
</script>


I have this error on Chrome:


Uncaught TypeError: (d.prog || "").toLowerCase is not a function


and this one on Firefox:


TypeError: "".toLowerCase is not a function.


I think it's because my data type is integer on these columns. I don't know how to solve this. Any ideas?

Answer

You need to define the type number so that there wont be any issue with number filtering. Refer below code

columns: [

    { field: 'prog', type:'number',  title: 'Prog', width: '60px' },

  ]
Comments