1 //<script type="text/javascript">
4 Ext.form.FieldSetEx = function(config){
5 Ext.form.FieldSetEx.superclass.constructor.call(this, config);
14 Ext.extend(Ext.form.FieldSetEx, Ext.form.FieldSet, {
15 collapseGroup : false,
21 defaultAutoCreate : {tag: 'fieldset', cn: { tag:'legend' }},
24 onRender : function(ct, position)
28 this.el = Roo.get(this.el);
30 // wrap the fieldset up so wee can mask the contents..
32 var cfg = this.getAutoCreate();
33 this.fs = ct.createChild(cfg, position);
35 this.fs.applyStyles(this.style);
37 // add the hidden value
39 this.hiddenEl = this.fs.createChild({
44 cls: 'x-form-item-display-none'
48 this.el = this.fs.createChild({tag: 'div' });
49 this.el.setVisibilityMode(Ext.Element.DISPLAY);
54 Ext.form.FieldSet.superclass.onRender.call(this, ct, position);
57 this.setLegend(this.legend);
60 this.el.createChild({ tag: 'div', cls: 'x-form-item' , html : this.innerHTML });
64 var l = this.fs.child('legend');
67 'transparent url('+ Ext.rootURL + '/images/default/menu/chk-sprite.gif) no-repeat scroll 0 0'
70 l.setStyle('padding', '0 5 0 20');
71 l.setStyle('cursor', 'pointer');
72 l.on('click', function() {
73 this.setExpand(!this.expanded);
79 // not sure why but it always shows up visiable...
80 setTimeout(function(){
85 setExpand : function(state) // expand/collapse this, and reflect on others...
87 this.expanded = state;
89 this.collapseOthers(state);
90 this.fireEvent('expand', this, state);
92 expand : function(state)
94 this.expanded = state;
95 var l = this.fs.child('legend');
96 l.setStyle('background-position', state ? '0 -16px': '0 0');
98 // 'background','transparent url('+ Ext.rootURL + 'images/default/menu/' +
99 // (state ? '' : 'un') + 'checked.gif) no-repeat scroll 0 0'
101 this.fs.setStyle('padding', state && !this.defaultBorder.length ? '10 10 5' : '0 10');
102 this.fs.setStyle('border', state ? this.defaultBorder : 'none');
103 var d = this.fs.query('div');
105 this.hiddenEl.dom.value = state * 1;
107 this.el.setVisible(state);
108 //Ext.each(d, function(e) {
109 // Ext.get(e).setVisibilityMode(Ext.Element.DISPLAY);
110 // Ext.get(e).setVisible(state);
116 collapseOthers: function(state)
118 if (!this.form) { // needs context
122 Ext.each(this.form.allItems, function(f){
125 if (f.collapseGroup && f.collapseGroup == _this.collapseGroup && _this.name != f.name) {
129 return false; // no more... (if we unexpand the only the first get's expanded..
136 setLegend : function(text){
138 var l = this.fs.child('legend');