This is a migrated thread and some comments may be shown as answers.

Kendo Filter on parsed input value

3 Answers 112 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 27 Aug 2015, 03:10 PM

My example: http://dojo.telerik.com/oWABE/3

Here I have a data object containing "status" which is an integer! (it is 1,2 or 3)

In my Grid that masks to New, Pending and Closed

To show the strings (New, Pending and Closed) I have created a parse function in the shema -> for filtering to work on the parsed values one cannot use a template in the columns definition, but has to parse it in the datasource!

Status: { type: "int",
         parse: function(status) {   
         console.log(status,"stat");           
           switch(status){
             case 1: return"New"; break;
             case 2: return"Pending"; break;
             case 3: return"Solved"; break;
             case 5: return"Closed"; break;
          }
     }
},
 
There is a "console.log" when this parser gets called and what I notice is that AFTER! I filter for "New" the log reads:

n stat
undefined "stat"

 

...when I first run the page the log reads (as expected):

 

1 "stat"
2 "stat"
3 "stat"

 

The Filter does not work (try filtering for "New" as an example)
Any help?

3 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 31 Aug 2015, 11:19 AM

Hello Markus,

You need to use schema.parse option to change the data that you get from the server to the desired output it is documented here:

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.parse

Please see the updated example:

http://dojo.telerik.com/oWABE/4

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Markus
Top achievements
Rank 1
answered on 01 Sep 2015, 12:04 PM
Great thank you!
0
Kiril Nikolov
Telerik team
answered on 01 Sep 2015, 12:22 PM

Hello Markus,

 

I am happy to help.

 

In case you have any further questions, please do not hesitate to contact us.

 

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Markus
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Markus
Top achievements
Rank 1
Share this question
or