Custom CSS for one cell inside a datagrid

1
I am using a data grid with one editable column where you can choose A, B or C from an enumeration drop down. When A is choosen the background for this cell should become red. When B is choosen the background should become Blue. And when C is choosen the background should remain default.   Is it possible to implement this with mendix?   it is not possible to get the $currentObject or the $currentRow inside a data grid using dynamic classes.
asked
2 answers
0

yes this is possible by using Java Script or Jquery 

add a class to all rows.

add Event Listener to that class using forEach loop of Javascript 

in this you can access this object which refer the current object 

so you can write you JS to change styling like 

this.style.backgroundColor  = red;

you are gettin row in this object the you can also target any column of the row by using 

nth-child

in jquery

 

 

Thanks 

Sanjay Kushwah

answered
0

Hi Bertran,

As you using enum attribute for a particular attribute you can use the dynamic classes for achieving this In the sense based on particular enum values as A,B and C if the user given the input as A then the background color wants to be red similarly for others aswell we can do.use if then else conditions to achive this.

Hope this information helps you.

answered