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

How can I add a class|style to a row depending on value within row item?

0 Answers 281 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jordon
Top achievements
Rank 1
Jordon asked on 14 May 2013, 07:03 PM
Hi,

I have a grid that has roughly 12 columns each that map to a field within the data or combine multiple.

My question is is there an easy way for me to add a class to a row if a value meets certain criteria?

Example: 

[{Status: Up, ............},{Status:Down,.........}]

First row may be green text, second row may be red text.

I was hoping for something easier than creating a row template, as I am afraid that if I do a row template I lose the ability to show/hide columns and filter. I also didn't want to do the row template simply to keep my html minimal.

Is there a better way that I have overlooked?

**Edit**

I suppose I could create a template for each column item and check the desired field and apply the css there.
{ field: 'Number', title: '#', template:'<div class="a-status-#= Status#">#=Number#</div>' },
Though I do not know how to perform a validation check with the kendo syntax
**   if (Status === "Up") add class, else do nothing  **

** Edit 2 **

Nevermind, poor research on my part. Found another question which adresses the same issue.

http://www.kendoui.com/forums/ui/grid/kendo-ui-style-grid-rows.aspx

I have used the Databound event solution.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Jordon
Top achievements
Rank 1
Share this question
or