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 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, {
75 getChildContainer : function() {
81 if (this.panel.length) {
82 return this.el.select('.panel-body',true).first();
89 getAutoCreate : function(){
92 tag : this.tag || 'div',
97 cfg.cls = 'jumbotron';
102 // - this is applied by the parent..
104 // cfg.cls = this.cls + '';
107 if (this.sticky.length) {
109 var bd = Roo.get(document.body);
110 if (!bd.hasClass('bootstrap-sticky')) {
111 bd.addClass('bootstrap-sticky');
112 Roo.select('html',true).setStyle('height', '100%');
115 cfg.cls += 'bootstrap-sticky-' + this.sticky;
119 if (this.well.length) {
123 cfg.cls +=' well well-' +this.well;
132 cfg.cls += ' hidden';
136 if (this.alert && ["success","info","warning", "danger"].indexOf(this.alert) > -1) {
137 cfg.cls +=' alert alert-' + this.alert;
142 if (this.panel.length) {
143 cfg.cls += ' panel panel-' + this.panel;
145 if (this.header.length) {
151 cfg.cls = cfg.cls + ' expandable';
155 cls: (this.expanded ? 'fa fa-minus' : 'fa fa-plus')
164 html : (this.expandable ? ' ' : '') + this.header
168 cls: 'panel-header-right',
174 cls : 'panel-heading',
175 style : this.expandable ? 'cursor: pointer' : '',
183 cls : 'panel-body' + (this.expanded ? '' : ' hide'),
188 if (this.footer.length) {
190 cls : 'panel-footer',
199 body.html = this.html || cfg.html;
200 // prefix with the icons..
202 body.html = '<i class="fa fa-'+this.fa + '"></i>' + body.html ;
205 body.html = '<i class="glyphicon glyphicon-'+this.icon + '"></i>' + body.html ;
210 if ((!this.cls || !this.cls.length) && (!cfg.cls || !cfg.cls.length)) {
211 cfg.cls = 'container';
217 initEvents: function()
219 if(!this.expandable){
223 var headerEl = this.headerEl();
229 headerEl.on('click', this.onToggleClick, this);
233 onToggleClick : function()
235 var headerEl = this.headerEl();
251 if(this.fireEvent('expand', this)) {
253 this.expanded = true;
255 //this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).show();
257 this.el.select('.panel-body',true).first().removeClass('hide');
259 var toggleEl = this.toggleEl();
265 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-minus']);
270 collapse : function()
272 if(this.fireEvent('collapse', this)) {
274 this.expanded = false;
276 //this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).hide();
277 this.el.select('.panel-body',true).first().addClass('hide');
279 var toggleEl = this.toggleEl();
285 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-plus']);
289 toggleEl : function()
291 if(!this.el || !this.panel.length || !this.header.length || !this.expandable){
295 return this.el.select('.panel-heading .fa',true).first();
298 headerEl : function()
300 if(!this.el || !this.panel.length || !this.header.length){
304 return this.el.select('.panel-heading',true).first()
309 if(!this.el || !this.panel.length || !this.header.length){
313 return this.el.select('.panel-title',true).first();
316 setTitle : function(v)
318 var titleEl = this.titleEl();
324 titleEl.dom.innerHTML = v;
327 getTitle : function()
330 var titleEl = this.titleEl();
336 return titleEl.dom.innerHTML;
339 setRightTitle : function(v)
341 var t = this.el.select('.panel-header-right',true).first();