3 <div class="modal fade">
4 <div class="modal-dialog">
5 <div class="modal-content">
6 <div class="modal-header">
7 <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
8 <h4 class="modal-title">Modal title</h4>
10 <div class="modal-body">
11 <p>One fine body…</p>
13 <div class="modal-footer">
14 <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
15 <button type="button" class="btn btn-primary">Save changes</button>
17 </div><!-- /.modal-content -->
18 </div><!-- /.modal-dialog -->
19 </div><!-- /.modal -->
29 * @class Roo.bootstrap.Modal
30 * @extends Roo.bootstrap.Component
31 * Bootstrap Modal class
32 * @cfg {String} title Title of dialog
33 * @cfg {Array} buttons Array of buttons
36 * Create a new Modal Dialog
37 * @param {Object} config The config object
40 Roo.bootstrap.Modal = function(config){
41 Roo.bootstrap.Modal.superclass.constructor.call(this, config);
44 Roo.extend(Roo.bootstrap.Modal, Roo.bootstrap.Component, {
46 title : 'test dialog',
49 onRender : function(ct, position){
50 Roo.bootstrap.Component.superclass.onRender.call(this, ct, position);
52 var cfg = Roo.apply({}, this.getAutoCreate());
55 // cfg.name = typeof(this.name) == 'undefined' ? this.id : this.name;
57 //if (!cfg.name.length) {
61 cfg.cls += ' ' + this.cls;
64 cfg.style = this.style;
66 this.el = Roo.get(document.body).createChild(cfg, position);
68 //var type = this.el.dom.type;
70 if(this.tabIndex !== undefined){
71 this.el.dom.setAttribute('tabIndex', this.tabIndex);
74 //this.el.addClass([this.fieldClass, this.cls]);
77 getAutoCreate : function(){
86 cls : "modal-content",
114 cls : 'btn btn-default',
119 cls : 'btn btn-primary',
140 getChildContainer : function() {
142 return this.el.select('.modal-body',true).first();
145 getButtonContainer : function() {
146 return this.el.select('.modal-footer',true).first();
149 initEvents : function()
151 this.el.select('.modal-header .close').on('click', this.hide, this);
154 this.el.addClass('on');
155 this.el.removeClass('fade');
156 this.el.setStyle('display', 'block');
159 this.el.removeClass('on');
160 this.el.addClass('fade');
161 this.el.setStyle('display', 'none');