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
48 * After the panel has been collapsed
50 * @param {Roo.bootstrap.Container} this
56 Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component, {
72 getChildContainer : function() {
78 if (this.panel.length) {
79 return this.el.select('.panel-body',true).first();
86 getAutoCreate : function(){
89 tag : this.tag || 'div',
94 cfg.cls = 'jumbotron';
99 // - this is applied by the parent..
101 // cfg.cls = this.cls + '';
104 if (this.sticky.length) {
106 var bd = Roo.get(document.body);
107 if (!bd.hasClass('bootstrap-sticky')) {
108 bd.addClass('bootstrap-sticky');
109 Roo.select('html',true).setStyle('height', '100%');
112 cfg.cls += 'bootstrap-sticky-' + this.sticky;
116 if (this.well.length) {
120 cfg.cls +=' well well-' +this.well;
129 cfg.cls += ' hidden';
133 if (this.alert && ["success","info","warning", "danger"].indexOf(this.alert) > -1) {
134 cfg.cls +=' alert alert-' + this.alert;
139 if (this.panel.length) {
140 cfg.cls += ' panel panel-' + this.panel;
142 if (this.header.length) {
161 cls: 'panel-header-right',
167 cls : 'panel-heading',
180 if (this.footer.length) {
182 cls : 'panel-footer',
191 body.html = this.html || cfg.html;
192 // prefix with the icons..
194 body.html = '<i class="fa fa-'+this.fa + '"></i>' + body.html ;
197 body.html = '<i class="glyphicon glyphicon-'+this.icon + '"></i>' + body.html ;
202 if ((!this.cls || !this.cls.length) && (!cfg.cls || !cfg.cls.length)) {
203 cfg.cls = 'container';
209 initEvents: function()
211 var toggleEl = this.toggleEl();
217 toggleEl.on('click', this.onToggleClick, this);
220 onToggleClick : function()
222 var toggleEl = this.toggleEl();
228 if(toggleEl.hasClass('fa-minus')){
239 if(this.fireEvent('expand', this)) {
240 this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).show();
242 var toggleEl = this.toggleEl();
248 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-minus']);
253 collapse : function()
255 if(this.fireEvent('collapse', this)) {
256 this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).hide();
258 var toggleEl = this.toggleEl();
264 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-plus']);
268 toggleEl : function()
270 if(!this.el || !this.panel.length || !this.header.length || !this.expandable){
274 return this.el.select('.panel-heading',true).first();
279 if(!this.el || !this.panel.length || !this.header.length){
283 return this.el.select('.panel-title',true).first();
286 setTitle : function(v)
288 var titleEl = this.titleEl();
294 titleEl.dom.innerHTML = v;
297 getTitle : function()
300 var titleEl = this.titleEl();
306 return titleEl.dom.innerHTML;
309 setRightTitle : function(v)
311 var t = this.el.select('.panel-header-right',true).first();