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, {
73 getChildContainer : function() {
79 if (this.panel.length) {
80 return this.el.select('.panel-body',true).first();
87 getAutoCreate : function(){
90 tag : this.tag || 'div',
95 cfg.cls = 'jumbotron';
100 // - this is applied by the parent..
102 // cfg.cls = this.cls + '';
105 if (this.sticky.length) {
107 var bd = Roo.get(document.body);
108 if (!bd.hasClass('bootstrap-sticky')) {
109 bd.addClass('bootstrap-sticky');
110 Roo.select('html',true).setStyle('height', '100%');
113 cfg.cls += 'bootstrap-sticky-' + this.sticky;
117 if (this.well.length) {
121 cfg.cls +=' well well-' +this.well;
130 cfg.cls += ' hidden';
134 if (this.alert && ["success","info","warning", "danger"].indexOf(this.alert) > -1) {
135 cfg.cls +=' alert alert-' + this.alert;
140 if (this.panel.length) {
141 cfg.cls += ' panel panel-' + this.panel;
143 if (this.header.length) {
162 cls: 'panel-header-right',
168 cls : 'panel-heading',
181 if (this.footer.length) {
183 cls : 'panel-footer',
192 body.html = this.html || cfg.html;
193 // prefix with the icons..
195 body.html = '<i class="fa fa-'+this.fa + '"></i>' + body.html ;
198 body.html = '<i class="glyphicon glyphicon-'+this.icon + '"></i>' + body.html ;
203 if ((!this.cls || !this.cls.length) && (!cfg.cls || !cfg.cls.length)) {
204 cfg.cls = 'container';
210 initEvents: function()
212 if(!this.expandable){
216 var headerEl = this.headerEl();
222 headerEl.on('click', this.onToggleClick, this);
226 onToggleClick : function()
228 var headerEl = this.headerEl();
245 if(this.fireEvent('expand', this)) {
246 this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).show();
248 var toggleEl = this.toggleEl();
254 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-minus']);
259 collapse : function()
261 if(this.fireEvent('collapse', this)) {
262 this.el.select('.panel-body',true).first().setVisibilityMode(Roo.Element.DISPLAY).hide();
264 var toggleEl = this.toggleEl();
270 toggleEl.removeClass(['fa-minus', 'fa-plus']).addClass(['fa-plus']);
274 toggleEl : function()
276 if(!this.el || !this.panel.length || !this.header.length || !this.expandable){
280 return this.el.select('.panel-heading .fa',true).first();
283 headerEl : function()
285 if(!this.el || !this.panel.length || !this.header.length){
289 return this.el.select('.panel-heading',true).first()
294 if(!this.el || !this.panel.length || !this.header.length){
298 return this.el.select('.panel-title',true).first();
301 setTitle : function(v)
303 var titleEl = this.titleEl();
309 titleEl.dom.innerHTML = v;
312 getTitle : function()
315 var titleEl = this.titleEl();
321 return titleEl.dom.innerHTML;
324 setRightTitle : function(v)
326 var t = this.el.select('.panel-header-right',true).first();