Custom class to row based on dataItem

2 posts, 1 answers
  1. Matjaž
    Matjaž avatar
    85 posts
    Member since:
    Jul 2015

    Posted 12 Oct 2016 Link to this post

    How can I add custom class to row based on dataItem?

    I think I could use rowTemplate, but that would ignore columns.template which is not OK. I also don't want to change rowTemplate just add some custom classes.

  2. Answer
    Dimiter Topalov
    Dimiter Topalov avatar
    1067 posts

    Posted 12 Oct 2016 Link to this post

    Hello Matjaž,

    You can handle the dataBound event, obtain all rendered items (rows) via the items() method, loop through them and use the dataItem() method to get the corresponding data item, then conditionally add custom class(es) to the TR, based on some property of the data item:

    The following how-to article from our documentation shows alternative approaches as well:

    I hope this helps.

    Dimiter Topalov
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top