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
56 * When a element is chick
57 * @param {Roo.bootstrap.Container} this
58 * @param {Roo.EventObject} e
64 Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component, {
82 getChildContainer : function() {
88 if (this.panel.length) {
89 return this.el.select('.panel-body',true).first();
96 getAutoCreate : function(){
99 tag : this.tag || 'div',
103 if (this.jumbotron) {
104 cfg.cls = 'jumbotron';
109 // - this is applied by the parent..
111 // cfg.cls = this.cls + '';
114 if (this.sticky.length) {
116 var bd = Roo.get(document.body);
117 if (!bd.hasClass('bootstrap-sticky')) {
118 bd.addClass('bootstrap-sticky');
119 Roo.select('html',true).setStyle('height', '100%');
122 cfg.cls += 'bootstrap-sticky-' + this.sticky;
126 if (this.well.length) {
130 cfg.cls +=' well well-' +this.well;
139 cfg.cls += ' hidden';
143 if (this.alert && ["success","info","warning", "danger"].indexOf(this.alert) > -1) {
144 cfg.cls +=' alert alert-' + this.alert;
149 if (this.panel.length) {
150 cfg.cls += ' panel panel-' + this.panel;
152 if (this.header.length) {
158 cfg.cls = cfg.cls + ' expandable';
162 cls: (this.expanded ? 'fa fa-minus' : 'fa fa-plus')
171 html : (this.expandable ? ' ' : '') + this.header
175 cls: 'panel-header-right',
181 cls : 'panel-heading',
182 style : this.expandable ? 'cursor: pointer' : '',
190 cls : 'panel-body' + (this.expanded ? '' : ' hide'),
195 if (this.footer.length) {
197 cls : 'panel-footer',
206 body.html = this.html || cfg.html;
207 // prefix with the icons..
209 body.html = '<i class="fa fa-'+this.fa + '"></i>' + body.html ;
212 body.html = '<i class="glyphicon glyphicon-'+this.icon + '"></i>' + body.html ;
217 if ((!this.cls || !this.cls.length) && (!cfg.cls || !cfg.cls.length)) {
218 cfg.cls = 'container';
224 initEvents: function()
226 if(!this.expandable){
230 var headerEl = this.headerEl();
236 headerEl.on('click', this.onToggleClick, this);
240 onToggleClick : function()
242 var headerEl = this.headerEl();
258 if(this.fireEvent('expand', this)) {
260 this.expanded = true;
262 //this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).show();
264 this.el.select('.panel-body',true).first().removeClass('hide');
266 var toggleEl = this.toggleEl();
272 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-minus']);
277 collapse : function()
279 if(this.fireEvent('collapse', this)) {
281 this.expanded = false;
283 //this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).hide();
284 this.el.select('.panel-body',true).first().addClass('hide');
286 var toggleEl = this.toggleEl();
292 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-plus']);
296 toggleEl : function()
298 if(!this.el || !this.panel.length || !this.header.length || !this.expandable){
302 return this.el.select('.panel-heading .fa',true).first();
305 headerEl : function()
307 if(!this.el || !this.panel.length || !this.header.length){
311 return this.el.select('.panel-heading',true).first()
316 if(!this.el || !this.panel.length || !this.header.length){
320 return this.el.select('.panel-title',true).first();
323 setTitle : function(v)
325 var titleEl = this.titleEl();
331 titleEl.dom.innerHTML = v;
334 getTitle : function()
337 var titleEl = this.titleEl();
343 return titleEl.dom.innerHTML;
346 setRightTitle : function(v)
348 var t = this.el.select('.panel-header-right',true).first();