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

Date = Date in the template :/

1 Answer 116 Views
ListView
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
sitefinitysteve asked on 19 Oct 2012, 02:13 PM
Ok so the data object I have to bind to (remote data, have no control over it) has a property called "Date", and since it's also sending me dates in ISO format I need to do one of these

#= kendo.toString(new Date(data.Date), 'hh:sstt') #

However the error thrown is "Date is not a function"

I do this same thing in another similar object whos date property is PublishedDate (not "Date") and the above code works fine...so I assume its the ambiguous naming.

Is there anything I can do outside of telling telligent community server to change their REST API :)

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 22 Oct 2012, 08:11 AM
Hello Steve,

Our templates by default use a with statement, which extends the scope chain of the model.

https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/with

The purpose of this approach is to reference the model properties directly and more easily.

You can try setting useWithBlock to false, as described at

http://docs.kendoui.com/getting-started/framework/templates/performance#disabling-%22with%22-blocking-in-kendo-ui-templates

If controlling how the template is created is not possible, another (even easier) option is to use window.Date() instead of just Date().

Regards,
Dimo
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ListView
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Veteran
Answers by
Dimo
Telerik team
Share this question
or