Completed
Last Updated: 22 Jan 2020 07:32 by ADMIN
Imported User
Created on: 28 Mar 2012 11:11
Category: Grid
Type: Feature Request
23
custom date format in (editable) grid column
When you configure a grid date-column with a custom format, the value configured in 'format' is parsed using JSON.parse. This requires the use of double quotes for both keys and values.

var a = "{0:dd/MMMM/yyyy}";    // example from docs
JSON.parse(a);    // SyntaxError: JSON.parse: expected property name or '}'

var b = '{"0":"dd-MM-yyyy"}';
JSON.parse(b);    // jey! 

However, if you use the latter, the generated template goes fubar with the message:

"Invalid template:' ... <td>${kendo.format("{"0":"dd-MM-yyyy"\}",theDataField)}</td> ... "

This makes sense when you look at the quote mismatch..
2 comments
ADMIN
Alex Hajigeorgieva
Posted on: 22 Jan 2020 07:32

Hi,

The Kendo UI Grid uses the columns.format to create the template for the column:

https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/columns.format

Kind Regards,
Alex Hajigeorgieva
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Robert
Posted on: 15 Dec 2012 21:31
Had a similar problem using validation/regular expressions in list tempaltes. What solved it for me was using a backslash '\' for escape characters. 

I would try something like {\"0\":\"dd-MM-yyyy\"}