Sidebar change icon

Hello DHMTL,

Is it possible to change an icon from the sidebar by script?
and is it possible to change the background-color by script?

regards,
Laurens

Hi

please attach screenshot and specify what icon and bg do you mean?

I’ve attached a screendump.

thanx,

Laurens


are you sure this is sidebar? how do you attach it to a cell?

I used the command:

mySidebar=main_layout.cells('b').attachSidebar( {width: 600});

Well,

by the default sidebar does not have icons. you set them by your code, so I guess you’re able to change them in the same way. regarding bg - its done by design, you can change it manually in dhtmlx.css at your own risk.

I used normal code to have the icons. (see attached picture of your own doc-side)
regards,

Laurens


Hi

items in sidebar are based on templates. to change icon you have to update it for certain item. please check the following demo:
dhtmlx.com/docs/products/dhtmlxS … _text.html

hope this will help

Thanx, that was the trick.

mySidebar.attachEvent(‘onSelect’, function(evId){
if (mySidebar.cells(evId).getText().icon==’…/dhtmlx_extra_imgs/pijlonder.png’){
mySidebar.cells(evId).setText({icon:’…/dhtmlx_extra_imgs/pijlrechts.png’});
} else {
mySidebar.cells(evId).setText({icon:’…/dhtmlx_extra_imgs/pijlonder.png’});
}
}

regards,

Laurens

Hi.
For the sidebar, you can use any picture, it must have the desired width and height