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 {Boolean} expanded (true|false) default true
27 * @cfg {String} rheader contet on the right of header
31 * Create a new Container
32 * @param {Object} config The config object
35 Roo.bootstrap.Container = function(config){
36 Roo.bootstrap.Container.superclass.constructor.call(this, config);
42 * After the panel has been expand
44 * @param {Roo.bootstrap.Container} this
49 * After the panel has been collapsed
51 * @param {Roo.bootstrap.Container} this
57 Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component, {
74 getChildContainer : function() {
80 if (this.panel.length) {
81 return this.el.select('.panel-body',true).first();
88 getAutoCreate : function(){
91 tag : this.tag || 'div',
96 cfg.cls = 'jumbotron';
101 // - this is applied by the parent..
103 // cfg.cls = this.cls + '';
106 if (this.sticky.length) {
108 var bd = Roo.get(document.body);
109 if (!bd.hasClass('bootstrap-sticky')) {
110 bd.addClass('bootstrap-sticky');
111 Roo.select('html',true).setStyle('height', '100%');
114 cfg.cls += 'bootstrap-sticky-' + this.sticky;
118 if (this.well.length) {
122 cfg.cls +=' well well-' +this.well;
131 cfg.cls += ' hidden';
135 if (this.alert && ["success","info","warning", "danger"].indexOf(this.alert) > -1) {
136 cfg.cls +=' alert alert-' + this.alert;
141 if (this.panel.length) {
142 cfg.cls += ' panel panel-' + this.panel;
144 if (this.header.length) {
150 cfg.cls = cfg.cls + ' expandable';
166 cls: 'panel-header-right',
172 cls : 'panel-heading',
180 cls : 'panel-body' + (this.expanded ? '' : ' hide'),
185 if (this.footer.length) {
187 cls : 'panel-footer',
196 body.html = this.html || cfg.html;
197 // prefix with the icons..
199 body.html = '<i class="fa fa-'+this.fa + '"></i>' + body.html ;
202 body.html = '<i class="glyphicon glyphicon-'+this.icon + '"></i>' + body.html ;
207 if ((!this.cls || !this.cls.length) && (!cfg.cls || !cfg.cls.length)) {
208 cfg.cls = 'container';
214 initEvents: function()
216 if(!this.expandable){
220 var headerEl = this.headerEl();
226 headerEl.on('click', this.onToggleClick, this);
230 onToggleClick : function()
232 var headerEl = this.headerEl();
248 if(this.fireEvent('expand', this)) {
250 this.expanded = true;
252 //this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).show();
254 this.el.select('.panel-body',true).first().removeClass('hide');
256 var toggleEl = this.toggleEl();
262 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-minus']);
267 collapse : function()
269 if(this.fireEvent('collapse', this)) {
271 this.expanded = false;
273 //this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).hide();
274 this.el.select('.panel-body',true).first().addClass('hide');
276 var toggleEl = this.toggleEl();
282 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-plus']);
286 toggleEl : function()
288 if(!this.el || !this.panel.length || !this.header.length || !this.expandable){
292 return this.el.select('.panel-heading .fa',true).first();
295 headerEl : function()
297 if(!this.el || !this.panel.length || !this.header.length){
301 return this.el.select('.panel-heading',true).first()
306 if(!this.el || !this.panel.length || !this.header.length){
310 return this.el.select('.panel-title',true).first();
313 setTitle : function(v)
315 var titleEl = this.titleEl();
321 titleEl.dom.innerHTML = v;
324 getTitle : function()
327 var titleEl = this.titleEl();
333 return titleEl.dom.innerHTML;
336 setRightTitle : function(v)
338 var t = this.el.select('.panel-header-right',true).first();