dhxWindow: Change BG color programmatically

I am trying to change the background color of the dhxWindow upon user input. I have used:

widget.config.css=“my-style”;

in the past with other widgets and it works well but does NOT seem to work with dhxWindow. Does anyone have any ideas as to how to make this work?

Hello cstff. Thank you for providing this interesting approach. I am going to experiment with it today and I will let you know what I find. I am also hopeful that someone form DHX has a ready-made solution (although I have tried many approaches without success). Again, thank you for taking the time to respond!

1 Like

Ignore my last response.

This could be a solution using the cssManager

function setBackgroundColor(color){
    dhx.cssManager.add({
        "background-color": color
    }, "bg-custom .dhx_layout, .bg-custom .dhx_layout-cell, .bg-custom .dhx_toolbar");
}

const win = new dhx.Window({
    title: "Select a background color",
    css: "bg-custom",
    width: 300,
    height: 350
})

win.attach("Colorpicker")

win.getWidget().events.on("change", color => {
    setBackgroundColor(color)
})

win.show();

:vulcan_salute:

2 Likes

Wow! I like this option. I’ve used cssManager in the past (albeit infrequently) but I did not think of that as an option. This should be easy to implement and test. THANK YOU!