10 * @class Roo.bootstrap.Container
11 * @extends Roo.bootstrap.Component
12 * Bootstrap Container class
13 * @cfg {Boolean} jumbotron is it a jumbotron element
14 * @cfg {String} html content of element
15 * @cfg {String} well (lg|sm|md) a well, large, small or medium.
16 * @cfg {String} panel (primary|success|info|warning|danger) render as a panel.
17 * @cfg {String} header content of header (for panel)
18 * @cfg {String} footer content of footer (for panel)
19 * @cfg {String} sticky (footer|wrap|push) block to use as footer or body- needs css-bootstrap/sticky-footer.css
20 * @cfg {String} tag (header|aside|section) type of HTML tag.
21 * @cfg {String} alert (success|info|warning|danger) type alert (changes background / border...)
22 * @cfg {String} fa (ban|check|...) font awesome icon
23 * @cfg {String} icon (info-sign|check|...) glyphicon name
24 * @cfg {Boolean} hidden (true|false) hide the element
25 * @cfg {Boolean} expandable (true|false) default false
26 * @cfg {String} rheader contet on the right of header
30 * Create a new Container
31 * @param {Object} config The config object
34 Roo.bootstrap.Container = function(config){
35 Roo.bootstrap.Container.superclass.constructor.call(this, config);
41 * After the panel has been expand
43 * @param {Roo.bootstrap.Container} this
49 Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component, {
65 getChildContainer : function() {
71 if (this.panel.length) {
72 return this.el.select('.panel-body',true).first();
79 getAutoCreate : function(){
82 tag : this.tag || 'div',
87 cfg.cls = 'jumbotron';
92 // - this is applied by the parent..
94 // cfg.cls = this.cls + '';
97 if (this.sticky.length) {
99 var bd = Roo.get(document.body);
100 if (!bd.hasClass('bootstrap-sticky')) {
101 bd.addClass('bootstrap-sticky');
102 Roo.select('html',true).setStyle('height', '100%');
105 cfg.cls += 'bootstrap-sticky-' + this.sticky;
109 if (this.well.length) {
113 cfg.cls +=' well well-' +this.well;
122 cfg.cls += ' hidden';
126 if (this.alert && ["success","info","warning", "danger"].indexOf(this.alert) > -1) {
127 cfg.cls +=' alert alert-' + this.alert;
132 if (this.panel.length) {
133 cfg.cls += ' panel panel-' + this.panel;
135 if (this.header.length) {
154 cls: 'panel-header-right',
160 cls : 'panel-heading',
173 if (this.footer.length) {
175 cls : 'panel-footer',
184 body.html = this.html || cfg.html;
185 // prefix with the icons..
187 body.html = '<i class="fa fa-'+this.fa + '"></i>' + body.html ;
190 body.html = '<i class="glyphicon glyphicon-'+this.icon + '"></i>' + body.html ;
195 if ((!this.cls || !this.cls.length) && (!cfg.cls || !cfg.cls.length)) {
196 cfg.cls = 'container';
202 initEvents: function()
204 var toggleEl = this.toggleEl();
210 toggleEl.on('click', this.onToggleClick, this);
213 onToggleClick : function()
215 var toggleEl = this.toggleEl();
221 if(toggleEl.hasClass('fa-minus')){
232 this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).show();
234 var toggleEl = this.toggleEl();
240 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-minus']);
244 collapse : function()
246 this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).hide();
248 var toggleEl = this.toggleEl();
254 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-plus']);
257 toggleEl : function()
259 if(!this.el || !this.panel.length || !this.header.length || !this.expandable){
263 return this.el.select('.panel-heading .fa',true).first();
268 if(!this.el || !this.panel.length || !this.header.length){
272 return this.el.select('.panel-title',true).first();
275 setTitle : function(v)
277 var titleEl = this.titleEl();
283 titleEl.dom.innerHTML = v;
286 getTitle : function()
289 var titleEl = this.titleEl();
295 return titleEl.dom.innerHTML;
298 setRightTitle : function(v)
300 var t = this.el.select('.panel-header-right',true).first()