10 * @class Roo.bootstrap.Container
11 * @extends Roo.bootstrap.Component
13 * Bootstrap Container class
14 * @cfg {Boolean} jumbotron is it a jumbotron element
15 * @cfg {String} html content of element
16 * @cfg {String} well (lg|sm|md) a well, large, small or medium.
17 * @cfg {String} panel (default|primary|success|info|warning|danger) render as panel - type - primary/success.....
18 * @cfg {String} header content of header (for panel)
19 * @cfg {String} footer content of footer (for panel)
20 * @cfg {String} sticky (footer|wrap|push) block to use as footer or body- needs css-bootstrap/sticky-footer.css
21 * @cfg {String} tag (header|aside|section) type of HTML tag.
22 * @cfg {String} alert (success|info|warning|danger) type alert (changes background / border...)
23 * @cfg {String} fa font awesome icon
24 * @cfg {String} icon (info-sign|check|...) glyphicon name
25 * @cfg {Boolean} hidden (true|false) hide the element
26 * @cfg {Boolean} expandable (true|false) default false
27 * @cfg {Boolean} expanded (true|false) default true
28 * @cfg {String} rheader contet on the right of header
29 * @cfg {Boolean} clickable (true|false) default false
33 * Create a new Container
34 * @param {Object} config The config object
37 Roo.bootstrap.Container = function(config){
38 Roo.bootstrap.Container.superclass.constructor.call(this, config);
44 * After the panel has been expand
46 * @param {Roo.bootstrap.Container} this
51 * After the panel has been collapsed
53 * @param {Roo.bootstrap.Container} this
58 * When a element is chick
59 * @param {Roo.bootstrap.Container} this
60 * @param {Roo.EventObject} e
66 Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component, {
84 getChildContainer : function() {
90 if (this.panel.length) {
91 return this.el.select('.panel-body',true).first();
98 getAutoCreate : function(){
101 tag : this.tag || 'div',
105 if (this.jumbotron) {
106 cfg.cls = 'jumbotron';
111 // - this is applied by the parent..
113 // cfg.cls = this.cls + '';
116 if (this.sticky.length) {
118 var bd = Roo.get(document.body);
119 if (!bd.hasClass('bootstrap-sticky')) {
120 bd.addClass('bootstrap-sticky');
121 Roo.select('html',true).setStyle('height', '100%');
124 cfg.cls += 'bootstrap-sticky-' + this.sticky;
128 if (this.well.length) {
132 cfg.cls +=' well well-' +this.well;
141 cfg.cls += ' hidden';
145 if (this.alert && ["success","info","warning", "danger"].indexOf(this.alert) > -1) {
146 cfg.cls +=' alert alert-' + this.alert;
151 if (this.panel.length) {
152 cfg.cls += ' panel panel-' + this.panel;
154 if (this.header.length) {
160 cfg.cls = cfg.cls + ' expandable';
164 cls: (this.expanded ? 'fa fa-minus' : 'fa fa-plus')
173 html : (this.expandable ? ' ' : '') + this.header
177 cls: 'panel-header-right',
183 cls : 'panel-heading',
184 style : this.expandable ? 'cursor: pointer' : '',
192 cls : 'panel-body' + (this.expanded ? '' : ' hide'),
197 if (this.footer.length) {
199 cls : 'panel-footer',
208 body.html = this.html || cfg.html;
209 // prefix with the icons..
211 body.html = '<i class="fa fa-'+this.fa + '"></i>' + body.html ;
214 body.html = '<i class="glyphicon glyphicon-'+this.icon + '"></i>' + body.html ;
219 if ((!this.cls || !this.cls.length) && (!cfg.cls || !cfg.cls.length)) {
220 cfg.cls = 'container';
226 initEvents: function()
229 var headerEl = this.headerEl();
232 headerEl.on('click', this.onToggleClick, this);
237 this.el.on('click', this.onClick, this);
242 onToggleClick : function()
244 var headerEl = this.headerEl();
260 if(this.fireEvent('expand', this)) {
262 this.expanded = true;
264 //this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).show();
266 this.el.select('.panel-body',true).first().removeClass('hide');
268 var toggleEl = this.toggleEl();
274 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-minus']);
279 collapse : function()
281 if(this.fireEvent('collapse', this)) {
283 this.expanded = false;
285 //this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).hide();
286 this.el.select('.panel-body',true).first().addClass('hide');
288 var toggleEl = this.toggleEl();
294 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-plus']);
298 toggleEl : function()
300 if(!this.el || !this.panel.length || !this.header.length || !this.expandable){
304 return this.el.select('.panel-heading .fa',true).first();
307 headerEl : function()
309 if(!this.el || !this.panel.length || !this.header.length){
313 return this.el.select('.panel-heading',true).first()
318 if(!this.el || !this.panel.length){
322 return this.el.select('.panel-body',true).first()
327 if(!this.el || !this.panel.length || !this.header.length){
331 return this.el.select('.panel-title',true).first();
334 setTitle : function(v)
336 var titleEl = this.titleEl();
342 titleEl.dom.innerHTML = v;
345 getTitle : function()
348 var titleEl = this.titleEl();
354 return titleEl.dom.innerHTML;
357 setRightTitle : function(v)
359 var t = this.el.select('.panel-header-right',true).first();
368 onClick : function(e)
372 this.fireEvent('click', this, e);