Kendo Grid Format On Some Condition

4 posts, 1 answers
  1. Navin
    Navin avatar
    20 posts
    Member since:
    Aug 2012

    Posted 22 Aug 2012 Link to this post

    Hello , How to format different row of Kendo Grid based on some condition like it's row value?
  2. Answer
    Iliana Nikolova
    Admin
    Iliana Nikolova avatar
    2595 posts

    Posted 27 Aug 2012 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Navin
    Navin avatar
    20 posts
    Member since:
    Aug 2012

    Posted 28 Aug 2012 Link to this post

    Thankz Nikolova... 
  5. gautam
    gautam avatar
    1 posts
    Member since:
    Jun 2012

    Posted 06 Sep 2012 Link to this post

    Hello  Iliana Nikolova,

    This thing is not working for me this is giving some error of  Invalid template;note is attached.
    thanks
Back to Top
Kendo UI is VS 2017 Ready