Background Color from Column based on Attribute

0
Hello Guys, Imagin the User have the opportunity to choose the Color of a Column in a Datagrid2 by himself.   So, in the Marketplace theres a Widget called → Color Picker. it looks like this.   When i save this, the #RGB Code is saved as a string in the Entity ColorPicker. The Entity have logically 4 Attritubes. – ColorColumn 1 - ColorColumn 2 - ColorColumn 3 - Color Column 4   Now the Question: How to make the Color of the Column based on that what the User choosed? .. is this somewhere here possible?   Thank you in advance for your Answers, Best Regard – Damir
asked
2 answers
1

Your only available content to use in this setup is the Orderline. So you have the option to extend entity Orderline with attributes Color1 to Color4, but that is not a nice solution and polluting your data with layout-attributes.

So next option is using a wrapper. Same as with setting ‘Personal settings’. Create an entity having those 4 attributes and give the user the option to set them somewhere. Then create a dataview, retrieving this object. In the dataview add your Orderline-DataGrid2. Now the ‘ Available variables’ will look like this:

where $dataView1 will hold your object with Color1 to Color4 attributes and your $currentObject will still be your Orderline. The expression will look something like this:

if($dataView1/Color1='#FF0000') then 'red' else ''

Good luck!

answered
0

Hi Tim,

First of all thank you for you answer. You have always good advices :)

 

i dit it like you said and the Variable is here. thats fine but in the Expression i dont know how the use the Color, from the User.

this works → if $currentObject/State = OrderManagement.OrderLineState._New then 'text-danger'

but it should be something like this →

if $currentObject/State = OrderManagement.OrderLineState._New then color: OrderManagment.ColorPicker_New
 

OrderManagment.ColorPicker_New = The choosen color from the User

 

answered