Is there anyway to change the form background color dynamically?
I have a classic grid that opens a form scenario for customer data, and I want it to work so that if I open a customer that is giving trouble, then the form background color becomes red.
Could you please provide two screenshots one with normal app state and one how you need it (you can use same screenshot just add some colors in corresponding places to see the difference)?
The first, customerList.jpg shows the list of customers, the ones with the red backround on the grid are the ones that have been blocked
The second image, customerDetails.jpg appears when you doubleclick on one of the customers on the grid. IF the customer is blocked, I want the back of this form (customerDetails.jpg) to be RED instead of white, to warn the user that the customer is blocked…
(Just imagine the background of the form changing color dynamically, i.e. when I load the form, IF the customer is blocked, the background has to be red.
imho not very good idea to work looking at red bg, but …
var w1 = dhxWins.window(id); // or you probably already have window instance
w1.vs[w1.av].dhxcont.firstChild.firstChild.style.backgroundColor="#ffe0e0";
how about just show topmost label in red “Customer is blocked”?
Yep Andrei, I agree with your color preferences … The whole point is the user MUST NOT work with a customer that is blocked, so the red is to discourage work !!
OK Sergei,
I think I’m on the right track, but I think that firstchild is wrong:
I have the following stucture:
// my window, “clientiWin” is the occurance you mentioned …
var clientiWin = mainLayout.dhxWins.createWindow(“wclienti”, 20, 20, 800, 600);
// The layout inside the window
clientiLayout = new dhtmlXLayoutObject(clientiWin,“1C”);
// A toolbar
clientiToolbar = clientiLayout.cells(“a”).attachToolbar();
// A grid in the normal view - view(“def”)
clientiGrid = clientiLayout.cells(“a”).attachGrid();
// and a form in the form view - view(“form”)
clientiForm = clientiLayout.cells(“a”).view(“form”).attachForm(formData);
// this is the element I have to change the backgound of
So I think I am not hitting the form when I call:
clientiWin.vs[clientiWin.av].dhxcont.firstChild.firstChild.style.backgroundColor="#ffe0e0";