PDA

View Full Version : [BUG ?] Fieldset doesn't show up after show



sirhaplo
27 Oct 2010, 12:24 AM
Hi guys,
I've a problem. Maybe a bug.

I have a hidden fieldset inside a FormPanel. An event will call .show() on that fieldset.
The problem is : if the fieldset is inside a FormPanel it doesn't appear, else if it is in a normal panel, it shows up.

Example :


var form = new Ext.form.FormPanel({
id: 'formUpload',
items: [{
xtype: 'textfield',
id: 'form-file',
fieldLabel: 'File',
name: 'path'
},
{
id: 'fieldSet',
xtype: 'fieldset',
hidden: true,
title: 'Warning',
items: [ { xtype: 'box', html: 'Warning box' } ]
}
]
});

var contentPanel = new Ext.Panel({
id: 'contentPanel',
items: [
form,
/*{
id: 'fieldSet',
xtype: 'fieldset',
hidden: true,
title: 'Warning',
items: [ { xtype: 'box', html: 'Warning box' } ]
},*/
new Ext.Button({ text: 'Show', handler: function() {
if (Ext.getCmp('fieldSet').isVisible())
{
Ext.getCmp('fieldSet').hide();
}
else {
Ext.getCmp('fieldSet').show();
}
}
})
]
});


The fieldset, id: fieldset, here doesn't work ... inside contentPanel (is commented) works like a charm.

Is a bug ? i'm doing wrong ?

Animal
27 Oct 2010, 12:48 AM
Why are you wrapping the FormPanel with a Panel?

Use ref to create a reference to the FieldSet.

Format code according to Ext standards:



var form = new Ext.form.FormPanel({
id: 'formUpload',
items: [{
xtype: 'textfield',
id: 'form-file',
fieldLabel: 'File',
name: 'path'
}, {
id: 'fieldSet',
ref: 'warning',
xtype: 'fieldset',
hidden: true,
title: 'Warning',
items: {
xtype: 'box',
html: 'Warning box'
}
}, {
xtype: 'button',
text: 'Show',
handler: function() {
if (form.warning.isVisible()) {
form.warning.hide();
} else {
form.warning.show();
}
}
}]
});

sirhaplo
27 Oct 2010, 1:01 AM
Why are you wrapping the FormPanel with a Panel?

This code was a simplification. In the real case this formPanel is wrapped inside a window.
I wrote that just for replicate that case.


Use ref to create a reference to the FieldSet.
Nice, I didn't know that feature


Format code according to Ext standards:
Where can i find some stylistic rules ?


Thanks so much for the quick answers

Animal
27 Oct 2010, 2:00 AM
Code to the standards in the Ext source.

Indent with 4 spaces. Braces do not go on new lines etc.

So how does your test go using ref? Did you un-nest a layer?

sirhaplo
27 Oct 2010, 2:50 AM
No way, no changes.
Still not working.

I've analyzed html code. Here what i found.

This piece of code :


{ id: 'fieldSet',
xtype: 'fieldset',
hidden: true,
title: 'Warning',
items: [ { xtype: 'box', html: 'Warning box' } ]
}


inside a standard panel is rendered like that :


<fieldset id="fieldSet" class="x-fieldset x-hide-display">
<legend class="x-fieldset-header x-unselectable" id="ext-gen90" style="-webkit-user-select: none; ">
<span class="x-fieldset-header-text" id="ext-gen93">Warning</span>
</legend>
<div class="x-fieldset-bwrap" id="ext-gen91">
<div class="x-fieldset-body" id="ext-gen92">
<div id="ext-comp-1004">Warning box</div>
</div>
</div>
</fieldset>


inside a FormPanel is rendered like that


<fieldset id="fieldSet" class=" x-fieldset x-form-label-left x-hide-display" style="width: 1666px; display: none; ">
<legend class="x-fieldset-header x-unselectable" id="ext-gen93" style="-webkit-user-select: none; ">
<span class="x-fieldset-header-text" id="ext-gen96">Warning</span>
</legend><div class="x-fieldset-bwrap" id="ext-gen94">
<div class="x-fieldset-body" id="ext-gen95" style="width: 1666px; ">
<div id="ext-comp-1003">Warning box</div>
</div>
</div>
</fieldset>


The main difference is the style inside the filedset tag

style="width: 1666px; display: none;

It override the 'x-hide-display'.
I think it's a bug

sirhaplo
27 Oct 2010, 5:47 AM
up.
I don't know if i can continue this way, or if I must change the layout beacause it's a bug.

Thanks