Color grid cell based on enum value

0
Hi all   I have a data grid on my page which has the answers to a survey filled out by other guests via a deeplink. For each question there are radio buttons for 4 enum values (Super good, good, okay, bad). I want each cell’s background to be a color depending on the value (e.g like in the picture).   In the marketplace I have  found a cell styler widget in the marketplace but I‘m not sure how to use that one. Does somebody know the answer?   Thanks  
asked
4 answers
2

Hi Lenny,

This forum posting gives a good explanation of how to use this:  https://forum.mendix.com/link/questions/110869

Once you’ve got that working, the documentation for this widget actually shows several different use cases that may be helpful.

One thing to keep in mind – when using Enumerations, you should use the Key value and not the Caption value in your expressions.

Hope that helps,

Mike

answered
0

Have you checked out the documentation tab for that widget? You can find it here:

If you run into any specific issues, feel free to update your post so we can help out :)

answered
0

Yes, we love the GridCellStyler. Great effect, but you do need to spend some time on the understanding and the javascript, which frankly I find very rewarding when succeseeding in getting it to look like you want to. Btw: here is an example site: https://mydemoversion8-sandbox.mxapps.io/p/appdemo/gridcellstyler

But there is an easier better maintainable way: give your enumerations an image for each value and using those images in the datagrid. See examples on https://baseapplication-sandbox.mxapps.io/, log in as visitor and go to ‘UI Helpers’.

But my favorite, which I recommend you to give it a go, is using DataGrid2. Download https://marketplace.mendix.com/link/component/116540/Mendix/Data-Widgets.

answered
0

Hi Tim

This is my column, I have used to name (column3) in the cell styler config. It has Attribute “ErwartungenKurs”.

 

Then I use that name in the javascript rule from you. The class to apply is “sehrgut_dg”. Also (===”Sehr gut”) is the caption but it also doesn’t work with the value anyway.

 

And this is my css class.

 

Shouldn’t it work?? Maybe the javascript is wrong?

answered