# Set Background color to cell and row in same table in perspective

**URL:** <https://forum.inductiveautomation.com/t/set-background-color-to-cell-and-row-in-same-table-in-perspective/50769>\
**Category:** Ignition\
**Created:** [September 9, 2021, 1:19pm UTC](https://forum.inductiveautomation.com/t/set-background-color-to-cell-and-row-in-same-table-in-perspective/50769 "2021-09-09T13:19:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [September 9, 2021, 1:19pm UTC](https://forum.inductiveautomation.com/t/set-background-color-to-cell-and-row-in-same-table-in-perspective/50769/1 "2021-09-09T13:19:02Z")

</div>

Hi,  
I want to set background color to cell and row depending on different conditions of column value in same table.  
I know how to do it separately for cells or rows but for same table it is little bit confusing for me.  
How can I achieve this.  
Any idea?  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [September 9, 2021, 1:42pm UTC](https://forum.inductiveautomation.com/t/set-background-color-to-cell-and-row-in-same-table-in-perspective/50769/2 "2021-09-09T13:42:30Z")

</div>

There have been posts about this before:  
you have to adjust the data input with a transform script

> [@Perspective table cell color](https://forum.inductiveautomation.com/t/perspective-table-cell-color/50047/2):
>
> you have to set the style/value a “level” deeper, like so: the row here is helsinki, the column is jakarta [image] [image] for the example code it would be something like: it can be a bit cleaner but this should get you started xd if value.getColumnName(col) == 'container\_type': if value.getValueAt(row, col) == 'can': #style row to orange row\_style = style\_orange elif value.getValueAt(row, col) == 'bottle': #style cel to green row\_object['value']['conta…

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [September 9, 2021, 2:08pm UTC](https://forum.inductiveautomation.com/t/set-background-color-to-cell-and-row-in-same-table-in-perspective/50769/3 "2021-09-09T14:08:53Z")

</div>

Thank you, will try this.

---

<div class="post-metadata">

**Author:** ![Anita.Shinde](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@Anita.Shinde](https://forum.inductiveautomation.com/u/Anita.Shinde)\
**Post date:** [September 9, 2021, 5:21pm UTC](https://forum.inductiveautomation.com/t/set-background-color-to-cell-and-row-in-same-table-in-perspective/50769/4 "2021-09-09T17:21:44Z")

</div>

Thanks a lot, it worked as expected.  
but After doing this columns order get changed automatically.  
I don’t want to change columns order, I want the same sequence which is at 1st time  
binding.  
I can’t use columns property because I am binding 3 different dataset(with conditions i.e. for production tab\>\>production Data, Service tag\>\>Service data, like this) to a single table  
Is there any way to avoid sorting or I need to create 3 different table and need to set columns property for that?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [September 10, 2021, 6:48am UTC](https://forum.inductiveautomation.com/t/set-background-color-to-cell-and-row-in-same-table-in-perspective/50769/5 "2021-09-10T06:48:36Z")

</div>

no you cant really sort json,  
you can also have a binding for the column with the conditions that change the columns order based on the selected tag
