individual colors / classes in Grid Cell Styler Widget

0
Hi all, currently I am trying to create a dynamic heatmap with a grid view and the grid cell styler widget from the Appstore. (Exampe: https://mydemoversion8-sandbox.mxapps.io/p/appdemo/gridcellstyler) I would like to color certain cells based on the value and it’s working quite well so far.  But when it comes to the classes/colors , it seems like i’m limited to the basic classes (info,primary, danger, warning, default). Is there a way to pass an parameter to the class in the widget to select other colors like in “Styles” in the properties section? For example “background-color: powderblue” is not working here… I would like to apply an idividual background color e.g. in RGB-Code. Or can I add new class somehow?   Many thanks in advance :) Not even the lighter versions of the background colors (bg-info, bg-danger,...) seem to work here...
asked
4 answers
2

Your conclusion is correct, you can only add a class, not a style. This is compliant with Mendix’ preference of using classes over inline styling. What you can do, is first add a class to your project’s styling in _custom.scss, say ‘myclass’, and add

{background-color: powderblue}

to it. Then enter ‘myclass’ as value for property ‘Class to apply’. If you want a different background-color for each different value of rowObj,integer, you will have to set one rule per value.

Ah, this is basicly what Mohammed lso said

answered
3

Hi Felix,

You can add one or more new class in your stylesheet and use that in the widget. 

Hope this helps!

answered
0

So I just added a new class in \theme\styles\css\custom.scss file but it did not work… the cell is not colored. 

Here is what I did:

and added 

.heatmap-first {background-color: powderblue}

saved and reopened the project, set class to apply on heatmap-first but it did not work.

Any idea what’s wrong?

Many thanks :)

answered
0

Thanks for the valuable hint @Eric :) 

I created the new class and it works fine for regular widgets now.

But it still does not for the Grid Cell Styler…

So there is definitaly no problem with the new class since it is working for other widgets but I am not able to make it work with the Grid Cell Styler. It seems like only the basic classes work for it.

Any additional ideas what I could try next?

 

  1.  → works with regular widgets!
  2.  → works!
  3.  → Does not work!
answered