From: Edward Date: Wed, 8 Aug 2018 08:49:09 +0000 (+0800) Subject: roojs-bootstrap.js X-Git-Url: http://git.roojs.org/?a=commitdiff_plain;h=5877d14dada2fd7b264f548a5ab3f44682ce4b05;p=roojs1 roojs-bootstrap.js roojs-bootstrap-debug.js --- diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index c04925938a..bc964e7126 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -851,9 +851,7 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component, { } if (this.pressed === true || this.pressed === false) { - this.pressed = !this.pressed; - this.el[this.pressed ? 'addClass' : 'removeClass']('active'); - this.fireEvent('toggle', this, e, this.pressed); + this.toggleActive(e); } @@ -889,12 +887,10 @@ Roo.extend(Roo.bootstrap.Button, Roo.bootstrap.Component, { /** * toggles the current active state */ - toggleActive : function() + toggleActive : function(e) { - var active = this.el.hasClass('active'); - this.setActive(!active); - - + this.setActive(!this.pressed); + this.fireEvent('toggle', this, e, !this.pressed); }, /** * get the current active state @@ -6555,7 +6551,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component, { - onLoad : function(event) + onLoad : function() { // Roo.log('ds onload'); this.clear(); @@ -6604,7 +6600,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component, { Roo.each(this.el.select('tbody td', true).elements, function(e){ e.on('mouseout', _this.onMouseout, _this); }); - this.fireEvent('rowsrendered', this, event); + this.fireEvent('rowsrendered', this); //if(this.loadMask){ // this.maskEl.hide(); //} diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 8986795b1e..d2fe3363dc 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -31,10 +31,10 @@ delete A.html;}A.cls+=this.parentType==='Navbar'?' navbar-btn':'';if(this.glyphi ;}A.cn=[B,{tag:'span',cls:'badge',html:this.badge}];A.html='';}if(this.menu){A.cls+=' dropdown';A.html=typeof(A.html)!='undefined'?A.html+' ':'';}if(A.tag!=='a'&&this.href!==''){throw "Tag must be a to set href."; }else if(this.href.length>0){A.href=this.href;}if(this.removeClass){A.cls='';}if(this.target){A.target=this.target;}return A;},initEvents:function(){if(typeof(this.menu)!='undefined'){this.menu.parentType=this.xtype;this.menu.triggerEl=this.el;this.addxtype(Roo.apply({} ,this.menu));}if(this.el.hasClass('roo-button')){this.el.on('click',this.onClick,this);}else{this.el.select('.roo-button').on('click',this.onClick,this);}if(this.removeClass){this.el.on('click',this.onClick,this);}this.el.enableDisplayMode();},onClick:function(e){if(this.disabled){return; -}Roo.log('button on click ');if(this.preventDefault){e.preventDefault();}if(this.pressed===true||this.pressed===false){this.pressed=!this.pressed;this.el[this.pressed?'addClass':'removeClass']('active');this.fireEvent('toggle',this,e,this.pressed);}this.fireEvent('click',this,e); -},enable:function(){this.disabled=false;this.el.removeClass('disabled');},disable:function(){this.disabled=true;this.el.addClass('disabled');},setActive:function(v){this.el[v?'addClass':'removeClass']('active');this.pressed=v;},toggleActive:function(){var A=this.el.hasClass('active'); -this.setActive(!A);},isActive:function(){return this.el.hasClass('active');},setText:function(A){this.el.select('.roo-button-text',true).first().dom.innerHTML=A;},getText:function(){return this.el.select('.roo-button-text',true).first().dom.innerHTML;},hide:function(){this.el.hide(); -},show:function(){this.el.show();},setWeight:function(A){this.el.removeClass(this.weightClass);this.el.addClass('btn-'+A);}}); +}Roo.log('button on click ');if(this.preventDefault){e.preventDefault();}if(this.pressed===true||this.pressed===false){this.toggleActive(e);}this.fireEvent('click',this,e);},enable:function(){this.disabled=false;this.el.removeClass('disabled');},disable:function(){this.disabled=true; +this.el.addClass('disabled');},setActive:function(v){this.el[v?'addClass':'removeClass']('active');this.pressed=v;},toggleActive:function(e){this.setActive(!this.pressed);this.fireEvent('toggle',this,e,!this.pressed);},isActive:function(){return this.el.hasClass('active'); +},setText:function(A){this.el.select('.roo-button-text',true).first().dom.innerHTML=A;},getText:function(){return this.el.select('.roo-button-text',true).first().dom.innerHTML;},hide:function(){this.el.hide();},show:function(){this.el.show();},setWeight:function(A){this.el.removeClass(this.weightClass); +this.el.addClass('btn-'+A);}}); // Roo/bootstrap/Column.js Roo.bootstrap.Column=function(A){Roo.bootstrap.Column.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Column,Roo.bootstrap.Component,{xs:false,sm:false,md:false,lg:false,xsoff:false,smoff:false,mdoff:false,lgoff:false,html:'',offset:0,alert:false,fa:false,icon:false,hidden:false,fasize:1,getAutoCreate:function(){var A=Roo.apply({} ,Roo.bootstrap.Column.superclass.getAutoCreate.call(this));A={tag:'div',cls:'column'};var B=this;['xs','sm','md','lg'].map(function(D){if(B[D+'off']!==false){A.cls+=' col-'+D+'-offset-'+B[D+'off'];}if(B[D]===false){return;}if(!B[D]){A.cls+=' hidden-'+D;return; @@ -257,10 +257,10 @@ var c={tag:'th',cls:'x-hcol-'+i,style:'',html:cm.getColumnHeader(i)};var hh='';i }if(hh.length){c.html=hh;}if(typeof(C.tooltip)!='undefined'){c.tooltip=C.tooltip;}if(typeof(C.colspan)!='undefined'){c.colspan=C.colspan;}if(typeof(C.hidden)!='undefined'&&C.hidden){c.style+=' display:none;';}if(typeof(C.dataIndex)!='undefined'){c.sort=C.dataIndex; }if(typeof(C.align)!='undefined'&&C.align.length){c.style+=' text-align:'+C.align+';';}if(typeof(C.width)!='undefined'){c.style+=' width:'+C.width+'px;';this.totalWidth+=C.width;}else{this.totalWidth+=100;}if(typeof(C.cls)!='undefined'){c.cls=(typeof(c.cls)=='undefined')?C.cls:(c.cls+' '+C.cls); }['xs','sm','md','lg'].map(function(D){if(typeof(C[D])=='undefined'){return;}if(!C[D]){c.cls+=' hidden-'+D;return;}c.cls+=' col-'+D+'-'+C[D];});A.cn.push(c)}return A;},renderBody:function(){var A={tag:'tbody',cn:[{tag:'tr',cn:[{tag:'td',colspan:this.cm.getColumnCount()} -]}]};return A;},renderFooter:function(){var A={tag:'tfoot',cn:[{tag:'tr',cn:[{tag:'td',colspan:this.cm.getColumnCount()}]}]};return A;},onLoad:function(A){this.clear();var B=this;var cm=this.cm;var ds=this.store;Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.select('i',true).removeClass(['glyphicon-arrow-up','glyphicon-arrow-down']); -if(B.store.sortInfo){if(e.hasClass('sortable')&&e.attr('sort')==B.store.sortInfo.field&&B.store.sortInfo.direction.toUpperCase()=='ASC'){e.select('i',true).addClass(['glyphicon-arrow-up']);}if(e.hasClass('sortable')&&e.attr('sort')==B.store.sortInfo.field&&B.store.sortInfo.direction.toUpperCase()=='DESC'){e.select('i',true).addClass(['glyphicon-arrow-down']); -}}});var C=this.mainBody;if(ds.getCount()>0){ds.data.each(function(d,D){var E=this.renderRow(cm,ds,D);C.createChild(E);var F=this;if(E.cellObjects.length){Roo.each(E.cellObjects,function(r){F.renderCellObject(r);})}},this);}Roo.each(this.el.select('tbody td',true).elements,function(e){e.on('mouseover',B.onMouseover,B); -});Roo.each(this.el.select('tbody td',true).elements,function(e){e.on('mouseout',B.onMouseout,B);});this.fireEvent('rowsrendered',this,A);this.autoSize();},onUpdate:function(ds,A){this.refreshRow(A);this.autoSize();},onRemove:function(ds,A,B,C){if(C!==true){this.fireEvent("beforerowremoved",this,B,A); +]}]};return A;},renderFooter:function(){var A={tag:'tfoot',cn:[{tag:'tr',cn:[{tag:'td',colspan:this.cm.getColumnCount()}]}]};return A;},onLoad:function(){this.clear();var A=this;var cm=this.cm;var ds=this.store;Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.select('i',true).removeClass(['glyphicon-arrow-up','glyphicon-arrow-down']); +if(A.store.sortInfo){if(e.hasClass('sortable')&&e.attr('sort')==A.store.sortInfo.field&&A.store.sortInfo.direction.toUpperCase()=='ASC'){e.select('i',true).addClass(['glyphicon-arrow-up']);}if(e.hasClass('sortable')&&e.attr('sort')==A.store.sortInfo.field&&A.store.sortInfo.direction.toUpperCase()=='DESC'){e.select('i',true).addClass(['glyphicon-arrow-down']); +}}});var B=this.mainBody;if(ds.getCount()>0){ds.data.each(function(d,C){var D=this.renderRow(cm,ds,C);B.createChild(D);var E=this;if(D.cellObjects.length){Roo.each(D.cellObjects,function(r){E.renderCellObject(r);})}},this);}Roo.each(this.el.select('tbody td',true).elements,function(e){e.on('mouseover',A.onMouseover,A); +});Roo.each(this.el.select('tbody td',true).elements,function(e){e.on('mouseout',A.onMouseout,A);});this.fireEvent('rowsrendered',this);this.autoSize();},onUpdate:function(ds,A){this.refreshRow(A);this.autoSize();},onRemove:function(ds,A,B,C){if(C!==true){this.fireEvent("beforerowremoved",this,B,A); }var bt=this.mainBody.dom;var D=this.el.select('tbody > tr',true).elements;if(typeof(D[B])!='undefined'){bt.removeChild(D[B].dom);}if(C!==true){this.fireEvent("rowremoved",this,B,A);}},onAdd:function(ds,A,B){var bt=this.mainBody.dom;for(var i=0;i