Reputation: 340
Good Morning everyone,
I'm currently trying to change the backgroundcolor for my widgets. Somehow it just doesn't work.
This is what my job file delivers:
return_array.push({value: value, label: row[0], color: color})
network = status_array[0..1] # This is pretty much return_array
send_event('network', {items: network[0]}) # sending data to the widget with data-id network
The widget I am using is the list widget.
Here's what my Coffeescript file looks like:
class Dashing.List extends Dashing.Widget
onData: (data) ->
color = data.items.color
$(@node).addClass "#{color}"
...
Color delivers either 'red' or 'green'
In my css file I got it setup like this:
.green {
background-color: $background-color;
}
.red {
background-color: #f13a2a;
}
Does anyone have an idea why it won't add the class? I can alert color and get back the value red / green
Upvotes: 1
Views: 1185
Reputation: 14671
try
onData: (data) =>
color = data.items.color
$(@node).addClass "#{color}"
Upvotes: 1