Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 958
Ginwu Avatar asked Mar 30 '15 12:03

Ginwu


2 Answers

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' },

  ]
like image 89
Sridhar Narasimhan Avatar answered Oct 11 '22 14:10

Sridhar Narasimhan


It should be "number" in the schema as well. I had "int" and it still didn't work

like image 27
William Avatar answered Oct 11 '22 15:10

William