/*
* redmicro all Copyright (c)
*
* Created by seeker910 on 2015/3/22.
*/
Rsd.define('Rsd.container.FieldSet', {
extend: 'Rsd.container.Component',
xtype: 'fieldset',
//margin: '10 0 10 0',
height: '100%',
width: '100%',
title: '',
bodyTagName:'fieldset',
cls:'x-fieldset',
/*
* null or undefined 不使用 */
legend:'',
/**
* 始终换行,在一列 显示所有组件
*/
alwaysWrap:false,
/*
* */
constructor: function FieldSet(config) {
config = config || {};
this.apply(config);
},
/**
*
*/
onAfterRender: function onAfterRender() {
//debugger;
this.callParent();
if(Rsd.isNullOrUndefined(this.legend))
{
this.setElStyle('body',{border:'0px',overflow:'visible'});
}
else
{
try
{
var el = document.createElement('legend');
el.innerText = this.legend;
var _c = this.body.element.firstChild;
if(_c == null)
{
this.body.element.appendChild(el);
}else
{
this.body.element.insertBefore(el,_c);
}
}catch (ex)
{
Rsd.error("添加legend失败",'Rsd.container.FieldSet',ex);
}
}
if(this.alwaysWrap)
{
this.setElStyle('body',{display: 'grid'});
}
else
{
this.setElStyle('body',{display: 'flex',flexFlow:'wrap'});
}
}
});