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

Kendo Grid Format On Some Condition

3 Answers 356 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Navin
Top achievements
Rank 1
Navin asked on 22 Aug 2012, 01:29 PM
Hello , How to format different row of Kendo Grid based on some condition like it's row value?

3 Answers, 1 is accepted

Sort by
0
Accepted
Iliana Dyankova
Telerik team
answered on 27 Aug 2012, 08:08 AM
Hello Navin,

To achieve this you could use row template, as in this online example. You can add some JavaScript code inside the template to check your condition, as shown in the Kendo UI template demo. For example this will set a red color to the "The Stars of Star Wars" movie row in the rowTemplate demo:  
<script id="rowTemplate" type="text/x-kendo-tmpl">
    # if (AverageRating == "2.9") { #
    <tr style="color:red;">
    # } else { #
    <tr>
    # } #
       <td>
             <img src="${ BoxArt.SmallUrl }" alt="${ Name }" />
       </td>
       <td>
             ${ Name }
       </td>
       <td>
             ${ AverageRating }
       </td>
     </tr>
</script>

I hope this helps.

Regards,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Navin
Top achievements
Rank 1
answered on 28 Aug 2012, 08:30 AM
Thankz Nikolova... 
0
gautam
Top achievements
Rank 1
answered on 06 Sep 2012, 09:34 AM
Hello  Iliana Nikolova,

This thing is not working for me this is giving some error of  Invalid template;note is attached.
thanks
Tags
ListView
Asked by
Navin
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Navin
Top achievements
Rank 1
gautam
Top achievements
Rank 1
Share this question
or