How to have correctly formated data in columns when row template is used?
I'm creating a grid with knockout-kendo where I define columns and row template:
<div data-bind="kendoGrid: {
data: Entries,
sortable: true,
selectable: true,
useKOTemplates: true,
rowTemplate: 'rowTemplate',
columns: [
{
title: 'Created on',
field: 'Timestamp',
format: '{0:d}'
},
{
title: 'The Mighty Value',
field: 'Value'
},
{
title: 'I.D.',
field: 'Id'
},
{}
]}"></div>
If I do so my first column's display format will be lost because of custom template. How to overcome this issue?
JSFiddle example: http://jsfiddle.net/cXDcm/7/
Because you are using a custom row template you are responsible to format your column values.
However you can you use the built in kendo.format
method also in your template to manually apply your formatting:
<td data-bind="text: kendo.format('{0:d}',Timestamp())"></td>
Demo JSFiddle.