10 * @class Roo.bootstrap.Container
11 * @extends Roo.bootstrap.Component
12 * @children Roo.bootstrap.Component
14 * Bootstrap Container class
15 * @cfg {Boolean} jumbotron is it a jumbotron element
16 * @cfg {String} html content of element
17 * @cfg {String} well (lg|sm|md) a well, large, small or medium.
18 * @cfg {String} panel (default|primary|success|info|warning|danger) render as panel - type - primary/success.....
19 * @cfg {String} header content of header (for panel)
20 * @cfg {String} footer content of footer (for panel)
21 * @cfg {String} sticky (footer|wrap|push) block to use as footer or body- needs css-bootstrap/sticky-footer.css
22 * @cfg {String} tag (header|aside|section) type of HTML tag.
23 * @cfg {String} alert (success|info|warning|danger) type alert (changes background / border...)
24 * @cfg {String} fa font awesome icon
25 * @cfg {String} icon (info-sign|check|...) glyphicon name
26 * @cfg {Boolean} hidden (true|false) hide the element
27 * @cfg {Boolean} expandable (true|false) default false
28 * @cfg {Boolean} expanded (true|false) default true
29 * @cfg {String} rheader contet on the right of header
30 * @cfg {Boolean} clickable (true|false) default false
34 * Create a new Container
35 * @param {Object} config The config object
38 Roo.bootstrap.Container = function(config){
39 Roo.bootstrap.Container.superclass.constructor.call(this, config);
45 * After the panel has been expand
47 * @param {Roo.bootstrap.Container} this
52 * After the panel has been collapsed
54 * @param {Roo.bootstrap.Container} this
59 * When a element is chick
60 * @param {Roo.bootstrap.Container} this
61 * @param {Roo.EventObject} e
67 Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component, {
85 getChildContainer : function() {
91 if (this.panel.length) {
92 return this.el.select('.panel-body',true).first();
99 getAutoCreate : function(){
102 tag : this.tag || 'div',
106 if (this.jumbotron) {
107 cfg.cls = 'jumbotron';
112 // - this is applied by the parent..
114 // cfg.cls = this.cls + '';
117 if (this.sticky.length) {
119 var bd = Roo.get(document.body);
120 if (!bd.hasClass('bootstrap-sticky')) {
121 bd.addClass('bootstrap-sticky');
122 Roo.select('html',true).setStyle('height', '100%');
125 cfg.cls += 'bootstrap-sticky-' + this.sticky;
129 if (this.well.length) {
133 cfg.cls +=' well well-' +this.well;
142 cfg.cls += ' hidden';
146 if (this.alert && ["success","info","warning", "danger"].indexOf(this.alert) > -1) {
147 cfg.cls +=' alert alert-' + this.alert;
152 if (this.panel.length) {
153 cfg.cls += ' panel panel-' + this.panel;
155 if (this.header.length) {
161 cfg.cls = cfg.cls + ' expandable';
165 cls: (this.expanded ? 'fa fa-minus' : 'fa fa-plus')
174 html : (this.expandable ? ' ' : '') + this.header
178 cls: 'panel-header-right',
184 cls : 'panel-heading',
185 style : this.expandable ? 'cursor: pointer' : '',
193 cls : 'panel-body' + (this.expanded ? '' : ' hide'),
198 if (this.footer.length) {
200 cls : 'panel-footer',
209 body.html = this.html || cfg.html;
210 // prefix with the icons..
212 body.html = '<i class="fa fa-'+this.fa + '"></i>' + body.html ;
215 body.html = '<i class="glyphicon glyphicon-'+this.icon + '"></i>' + body.html ;
220 if ((!this.cls || !this.cls.length) && (!cfg.cls || !cfg.cls.length)) {
221 cfg.cls = 'container';
227 initEvents: function()
230 var headerEl = this.headerEl();
233 headerEl.on('click', this.onToggleClick, this);
238 this.el.on('click', this.onClick, this);
243 onToggleClick : function()
245 var headerEl = this.headerEl();
261 if(this.fireEvent('expand', this)) {
263 this.expanded = true;
265 //this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).show();
267 this.el.select('.panel-body',true).first().removeClass('hide');
269 var toggleEl = this.toggleEl();
275 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-minus']);
280 collapse : function()
282 if(this.fireEvent('collapse', this)) {
284 this.expanded = false;
286 //this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).hide();
287 this.el.select('.panel-body',true).first().addClass('hide');
289 var toggleEl = this.toggleEl();
295 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-plus']);
299 toggleEl : function()
301 if(!this.el || !this.panel.length || !this.header.length || !this.expandable){
305 return this.el.select('.panel-heading .fa',true).first();
308 headerEl : function()
310 if(!this.el || !this.panel.length || !this.header.length){
314 return this.el.select('.panel-heading',true).first()
319 if(!this.el || !this.panel.length){
323 return this.el.select('.panel-body',true).first()
328 if(!this.el || !this.panel.length || !this.header.length){
332 return this.el.select('.panel-title',true).first();
335 setTitle : function(v)
337 var titleEl = this.titleEl();
343 titleEl.dom.innerHTML = v;
346 getTitle : function()
349 var titleEl = this.titleEl();
355 return titleEl.dom.innerHTML;
358 setRightTitle : function(v)
360 var t = this.el.select('.panel-header-right',true).first();
369 onClick : function(e)
373 this.fireEvent('click', this, e);