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

Certain single letter field names cause "type error: number is not a function" when rendering grid

4 Answers 57 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 07 Oct 2013, 05:08 PM
See the fiddle here: http://jsfiddle.net/rydama/KaTg2/9

The problem is with the 'e' field in the data object. When kendo is rendering the row template, it is using this object and the 'e' field conflicts with the js code it created for the template which starts out like this:

function anonymous(data
    /**/
) {
    var o, e = kendo.htmlEncode;
    with(data) {
       o = '<tr data-uid="' + (data.uid)
 
...
...


I can workaround this by mangling my field name, but should I need to? Is this something that should be fixed in kendoui?

Thanks


4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 08 Oct 2013, 11:07 AM
Hello Ryan,

 This can be addressed like this: http://jsfiddle.net/KaTg2/10/

 We are not sure if this can be fixed by default. We can use some obscure names but nothing can guarantee that the developer will not end up using the same.

Regards,
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Ryan
Top achievements
Rank 1
answered on 08 Oct 2013, 02:24 PM
Thanks.      
templateSettings: { useWithBlock: false }
does take care of it. 


For the benefit of others, note that you will also need to qualify things that end up in a template with the 'data' object, like:       
    columnInfo.footerTemplate = "<b> #= kendo.toString(data.sum, 'n') # </b>";


0
Ryan
Top achievements
Rank 1
answered on 10 Oct 2013, 11:02 PM
Hi Atanas,

Unfortunately, I've discovered a drawback to specifying useWithBlock: false

My groupFooterTemplate is no longer applied when grouping. See this fiddle for an example.  http://jsfiddle.net/rydama/KaTg2/22/

Do you know a way to get the footerTemplate working again when using useWithBlock: false ?

Thanks


0
Atanas Korchev
Telerik team
answered on 11 Oct 2013, 07:21 AM
Hi Ryan,

 You need to tweak the templates a bit to make it work. Here is the updated fiddle: http://jsfiddle.net/KaTg2/27/

Regards,
Atanas Korchev
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
Ryan
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Ryan
Top achievements
Rank 1
Share this question
or