PDA

View Full Version : how to put a div in a html fieldset



olriche38
21 Mar 2010, 11:50 AM
Hello,

I have a question, this is my code :

var html = '';
var html ='<div class="ligne">';
var y=0;
for(i=0; i<colorTabs.length;i++){
if(Math.floor((i)/8) == y){
html += '<div id="cell_'+i+'" class="cell"><div id="color_'+i+'" class="cellColor"></div></div>';
}else{
html += '</div><div class="ligne"><div class="cell" id="cell_'+i+'"><div id="color_'+i+'" class="cellColor"></div></div>';
y++;
}
}
html += '</div>';
var fsf = new Ext.FormPanel({
labelWidth: 60, // label settings here cascade unless overridden
url:'save-form.php',
frame:true,
title: 'Simple Form with FieldSets',
bodyStyle:'padding:5px 5px 0',
width: 200,

items: [{
xtype:'fieldset',
collapsible: true,
title: 'Couleur',
autoHeight:true,
defaults: {width: 80},
defaultType: 'textfield',
// collapsed: true,
html: html

}

And After,

var colorTabs = [
'000000', '222222', '444444', '666666', '999999', 'BBBBBB', 'DDDDDD', 'FFFFFF',
'660000', '663300', '996633', '003300', '003399', '000066', '330066', '660066',
'990000', '993300', 'CC9900', '006600', '0033FF', '000099', '660099', '990066',
'CC0000', 'CC3300', 'FFCC00', '009900', '0066FF', '0000CC', '663399', 'CC0099',
'FF0000', 'FF3300', 'FFFF00', '00CC00', '0099FF', '0000FF', '9900CC', 'FF0099',
'CC3333', 'FF6600', 'FFFF33', '00FF00', '00CCFF', '3366FF', '9933FF', 'FF00FF',
'FF6666', 'FF6633', 'FFFF66', '66FF66', '00FFFF', '3399FF', '9966FF', 'FF66FF',
'FF9999', 'FF9966', 'FFFF99', '99FF99', '99FFFF', '66CCFF', '9999FF', 'FF99FF',
'FFCCCC', 'FFCC99', 'FFFFCC', 'CCFFCC', 'CCFFFF', '99CCFF', 'CCCCFF', 'FFCCFF',
];

for(i=0; i<colorTabs.length;i++){
color = '#'+colorTabs[i];
$('#color_'+i).css('backgroundColor', color);
}

But I can't change the background color of my div!!

Is it possible to define a div in html, and to but this div in the fieldset???

Condor
22 Mar 2010, 5:01 AM
Your divs need to contain something (e.g. &#160;).

Any reason you are not using an Ext.ColorPalette (optionally with a different tpl to match your markup)?

ps. Why are you mixing jQuery and Ext? Why not use:

Ext.get('#color_'+i).setStyle('backgroundColor', color);