Add a background image to a layout cell

Whats a way to add an background image to a layout cell?

Forgot to mention that i’m using dhtmlx 4.0.

Hi
The next way:

myLayout.cells("b").cell.style.backgroundColor = "#00CED1";

Hy Darla, i dont understand your answer: the question is how to put an image in the background but the code shows how to change the background color!!!

She like quests :wink:

What content inside a cell?

Wow, my old humorous friend Andrei!

My basic layout for my dhtmlx apps is to put a layout in the window:

layMain = new dhtmlXLayoutObject(document.body,"1C");
layMain.cells("a").hideHeader();

Give the layout a menu (so it look just like a windows app)

and then open windows inside the layout.

So, when no windows are open all the user sees is layMain.cells(“a”), blank and boring.

It would be nice to put a nice company logo centered in the layout.
Ideally It would be nice it the image resized automatically when the browser resizes!

Hi fdl333 :slight_smile:

Once after dhtmlx.js loaded:

dhtmlXLayoutCell.prototype.setBG = function(url,color){ var cont = this.cell.childNodes[this.conf.idx.cont]; if (url != null) { cont.style.backgroundImage = "url("+url+")"; cont.style.backgroundPosition = "center center"; cont.style.backgroundRepeat = "no-repeat"; } if (color != null) { cont.style.backgroundColor = color; } cont = null; };

and then use:

myLayout.cells(id).setBG("http://dhtmlx.com/codebase/images/dhtmlx-logo-new-2x.png", "#3c7a9f");

PERFECT!!!

Thanks Andrei!