PDA

View Full Version : How to change border color of gridpanel dynamically?



bilguun_aaa
2 Sep 2010, 11:15 PM
Hi all, i am a new to ExtJs.

how to change border color of gridpanel dynamically?

I tried following, but not works :-/

myGridPanel.getEl().style = "border: solid 1px red;";


Thank you for attention.

Condor
3 Sep 2010, 12:49 AM
You could use Ext:

myGridPanel.getEl().applyStyles('border: solid 1px red');
or access the dom directly:

myGridPanel.getEl().dom.style.border = 'solid 1px red';

laurentParis
3 Sep 2010, 12:59 AM
with solution that propose condor border red is adding to border blue ! you have two borders !

class .x-panel-body set border color of grid body part
and class .x-panel-header set color of grid header part

so if you want to change border color of your grid, you must add/remove class of grid



mygrid.addClass('borderred');
...
mygrid.removeClass('borderred');
and add this css line after including ext-all.css


.borderred .x-panel-header, .borderred .x-panel-body {border-color: red;}

Condor
3 Sep 2010, 1:06 AM
Or simply:

myGridPanel.body.applyStyles('border: solid 1px red');

bilguun_aaa
3 Sep 2010, 1:28 AM
myGridPanel.getEl().applyStyles('border: solid 1px red');
myGridPanel.getEl().dom.style.border = 'solid 1px red';

are both works prefectly :):).
Thank you very much Condor.

bilguun_aaa
3 Sep 2010, 1:30 AM
Thanks Laurent for fast reply too.

bilguun_aaa
3 Sep 2010, 1:39 AM
Thank you Laurent, i will consider your method too.