Page 2 of 2
Re: set color based on value
Posted: Wednesday 18 November 2020 21:42
by Vondee
I tried this:
Code: Select all
function getStatus_28(block){
var idx = block.idx;
var device = block.device;
if (device['Data'] == 'Off') {
Dashticz.setBlock('462', {
addClass: 'warningyellow'
});
}
else {
Dashticz.setBlock('462', {
addClass: ''
});
}
But is seem not to work?
The color of block 462 does not change
Re: set color based on value
Posted: Wednesday 18 November 2020 21:51
by Lokonli
Your code looks ok.
How do you handle .warningyellow in custom.css?
Sent from my SM-A320FL using Tapatalk
Re: set color based on value
Posted: Wednesday 18 November 2020 22:12
by Vondee
Re: set color based on value
Posted: Wednesday 18 November 2020 22:49
by Lokonli
Device 28 is a switch?
How did you define the block for device 28?
Device 28 must have been added to a column as well.
How did you define block "462" in CONFIG.js?
How did you add it to a column?
Re: set color based on value
Posted: Wednesday 18 November 2020 23:02
by Vondee
Yes, device 28 is a switch.
In CONFIG.js:
Code: Select all
blocks[28] = {}
blocks[28]['title'] = 'Laders'
blocks[28]['icon'] = 'fas fa-battery-half'
blocks[28]['hide_data'] = 1
blocks[462] = {}
blocks[462]['title'] = "Batterij"
blocks[462]['switch'] = 1
blocks[462]['icon'] = 'fa fa-car'
In the column:
Code: Select all
columns[1]['blocks'] = ['blocktitle_1','graph_337','64_1','332_1','58_1',333,'141_2','141_5',462,498,458,500,68,39,362,36,28]
Re: set color based on value
Posted: Wednesday 18 November 2020 23:31
by Lokonli
That all looks fine.
What's your Dashticz version?
Any other class in custom.css that sets a color value?
Sent from my SM-A320FL using Tapatalk
Re: set color based on value
Posted: Saturday 21 November 2020 8:54
by Vondee
I still had Dashtics version 2. Upgraded to version 3 and it works. Thanks
Re: set color based on value
Posted: Saturday 21 November 2020 13:39
by Lokonli
Good to hear it's working. Next time the version number will be my first question
Sent from my SM-A320FL using Tapatalk
Re: set color based on value
Posted: Monday 14 December 2020 13:38
by Vondee
I tried to use the 'SetBlock' for a dial to change the Title, but that does not work?
Re: set color based on value
Posted: Monday 14 December 2020 22:40
by Lokonli
Vondee wrote: ↑Monday 14 December 2020 13:38
I tried to use the 'SetBlock' for a dial to change the Title, but that does not work?
setBlock indeed doesn't work for dial blocks.
I'll try to add that in a future update.
Re: set color based on value
Posted: Wednesday 16 December 2020 20:45
by Vondee
Nice! Looking forward for the update
Thanks