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

rowTemplate and format for column

3 Answers 495 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrey
Top achievements
Rank 1
Andrey asked on 06 Nov 2012, 09:31 PM
Hi there, 
Problem: I have a column in the kendoGrid described as:
{ title: "Column1", field: "Column1", width: "100px", format:"{0:p}" },
and it applies format properly.
Now, I created rowTemplate that says:
    <tr>
        <td>${Column1}</td>
    </tr>
And assign this template to grid using rowTemplate: kendo.template($("#rowTemplate").html())
As soon as I have template assigned I lost formating for column and instead of 2.75% I see 0.0275.

What whould you recomend to have formatting and assigned in case of row template.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 07 Nov 2012, 07:59 AM
Hello Andrey,

Using row template will ignore all columns template. You must define the row template to format the column fields. For example to achieve similar formatting with row template, the template must be as follows:
'<tr>
 <td>#=kendo.format("{0:p}", Column1)#</td>
</tr>'


Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Jamie Hassall
Top achievements
Rank 1
answered on 02 Oct 2015, 01:45 PM

 

Hi

trying to change the date time format of the " IDocumentDateExpired" filed to dd/MM/yyyy inside the row template

but it given me an error of the name dd does not exist. any help would be appreciated

 "<span class='header_style'> #= kendo.format("{ 0:dd / MM / yyyy} ",DocumentDateExpired) # " +​

 

Thanks

0
Jamie Hassall
Top achievements
Rank 1
answered on 02 Oct 2015, 02:36 PM

Hi

I fixed it guys 

all i did was  I add backslash before the braces

"<span class='header_style'> #= kendo.format(\"{ 0:dd / MM / yyyy} \",DocumentDateExpired) # " +​

 

Thanks

 

 

Tags
Grid
Asked by
Andrey
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Jamie Hassall
Top achievements
Rank 1
Share this question
or