Roo/bootstrap/Table.js
authorAlan Knowles <alan@roojs.com>
Fri, 30 Jan 2015 08:39:08 +0000 (16:39 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 30 Jan 2015 08:39:08 +0000 (16:39 +0800)
roojs-bootstrap.js
roojs-bootstrap-debug.js

roojs-bootstrap-debug.js
roojs-bootstrap.js

index c36c446..42b9389 100644 (file)
@@ -1157,7 +1157,7 @@ Roo.extend(Roo.bootstrap.Link, Roo.bootstrap.Component,  {
     
     initEvents: function() {
         
-        if(!this.href){
+        if(!this.href || this.preventDefault){
             this.el.on('click', this.onClick, this);
         }
     },
@@ -4836,7 +4836,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     {
         var cell = Roo.get(el);
         
-        if(!cell || !this.CellSelection || !this.RowSelection){
+        if(!cell || (!this.CellSelection && !this.RowSelection)){
             return;
         }
         
@@ -4864,7 +4864,7 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component,  {
     {
         var cell = Roo.get(el);
         
-        if(!cell || !this.CellSelection || !this.RowSelection){
+        if(!cell || (!this.CellSelection && !this.RowSelection)){
             return;
         }
         
@@ -19120,7 +19120,7 @@ Roo.extend(Roo.bootstrap.dash.TabBox, Roo.bootstrap.Component,  {
     },
     initEvents : function()
     {
-        Roo.log('add add pane handler');
+        //Roo.log('add add pane handler');
         this.on('addpane', this.onAddPane, this);
     },
      /**
@@ -19133,8 +19133,8 @@ Roo.extend(Roo.bootstrap.dash.TabBox, Roo.bootstrap.Component,  {
     },
     onAddPane : function(pane)
     {
-        Roo.log('addpane');
-        Roo.log(pane);
+        //Roo.log('addpane');
+        //Roo.log(pane);
         // tabs are rendere left to right..
         var ctr = this.el.select('.nav-tabs', true).first();
          
@@ -19165,7 +19165,7 @@ Roo.extend(Roo.bootstrap.dash.TabBox, Roo.bootstrap.Component,  {
     },
     onTabClick : function(ev,un,ob,pane)
     {
-        Roo.log('tab - prev default');
+        //Roo.log('tab - prev default');
         ev.preventDefault();
         
         
@@ -19218,13 +19218,7 @@ Roo.extend(Roo.bootstrap.dash.TabPane, Roo.bootstrap.Component,  {
     
     // the tabBox that this is attached to.
     tab : false,
-    
-//    
-//    getBox : function()
-//    {
-//        return this.el.findParent('.nav-tabs-custom', false, true);
-//    },
-    
+     
     getAutoCreate : function() 
     {
         var cfg = {
@@ -19240,7 +19234,7 @@ Roo.extend(Roo.bootstrap.dash.TabPane, Roo.bootstrap.Component,  {
     },
     initEvents  : function()
     {
-        Roo.log('trigger add pane handler');
+        //Roo.log('trigger add pane handler');
         this.parent().fireEvent('addpane', this)
     },
     
index 632d939..4eecacb 100644 (file)
@@ -31,7 +31,7 @@ Roo.bootstrap.Img=function(A){Roo.bootstrap.Img.superclass.constructor.call(this
 A.html=this.html||A.html;A.src=this.src||A.src;if(['rounded','circle','thumbnail'].indexOf(this.border)>-1){A.cls+=' img-'+this.border;}if(this.alt){A.alt=this.alt;}if(this.href){var a={tag:'a',href:this.href,cn:[A]};if(this.target){a.target=this.target;}}return (this.href)?a:A;},initEvents:function(){if(!this.href){this.el.on('click',this.onClick,this);}},onClick:function(e){Roo.log('img onclick');this.fireEvent('click',this,e);}});
 //Roo/bootstrap/Link.js
 Roo.bootstrap.Link=function(A){Roo.bootstrap.Link.superclass.constructor.call(this,A);this.addEvents({"click":true});};Roo.extend(Roo.bootstrap.Link,Roo.bootstrap.Component,{href:false,target:false,preventDefault:false,getAutoCreate:function(){var A={tag:'a',html:this.html||'html-missing'};if(this.alt){A.alt=this.alt;}
-A.href=this.href||'#';if(this.target){A.target=this.target;}return A;},initEvents:function(){if(!this.href){this.el.on('click',this.onClick,this);}},onClick:function(e){if(this.preventDefault){e.preventDefault();}
+A.href=this.href||'#';if(this.target){A.target=this.target;}return A;},initEvents:function(){if(!this.href||this.preventDefault){this.el.on('click',this.onClick,this);}},onClick:function(e){if(this.preventDefault){e.preventDefault();}
 this.fireEvent('click',this,e);}});
 //Roo/bootstrap/Header.js
 Roo.bootstrap.Header=function(A){Roo.bootstrap.Header.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Header,Roo.bootstrap.Component,{html:false,level:1,getAutoCreate:function(){var A={tag:'h'+(1*this.level),html:this.html||'fill in html'};return A;}});
@@ -113,7 +113,7 @@ this.addEvents({"cellclick":true,"celldblclick":true,"rowclick":true,"rowdblclic
 A.cn.push(this.renderBody());if(this.tfoot){A.cn.push(this.renderFooter());}
 A.cls+=' TableGrid';}return {cn:[A]};},initEvents:function(){if(!this.store||!this.cm){return;}
 Roo.log('initEvents with ds!!!!');var A=this;Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.on('click',A.sort,A);});this.el.on("click",this.onClick,this);this.el.on("dblclick",this.onDblClick,this);this.parent().el.setStyle('position','relative');if(this.footer){this.footer.parentId=this.id;this.footer.onRender(this.el.select('tfoot tr td').first(),null);}
-this.maskEl=new Roo.LoadMask(this.el,{store:this.ds,msgCls:'roo-el-mask-msg'});this.store.on('load',this.onLoad,this);this.store.on('beforeload',this.onBeforeLoad,this);},onMouseover:function(e,el){var A=Roo.get(el);if(!A){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}var B=A.findParent('tr',false,true);var C=A.dom.cellIndex;var D=B.dom.rowIndex-1;this.fireEvent('mouseover',this,A,D,C,e);},onMouseout:function(e,el){var A=Roo.get(el);if(!A){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}var B=A.findParent('tr',false,true);var C=A.dom.cellIndex;var D=B.dom.rowIndex-1;this.fireEvent('mouseout',this,A,D,C,e);},onClick:function(e,el){var A=Roo.get(el);if(!A||!this.CellSelection||!this.RowSelection){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}var B=A.findParent('tr',false,true);var C=A.dom.cellIndex;var D=B.dom.rowIndex-1;if(this.CellSelection){this.fireEvent('cellclick',this,A,D,C,e);}if(this.RowSelection){this.fireEvent('rowclick',this,B,D,e);}},onDblClick:function(e,el){var A=Roo.get(el);if(!A||!this.CellSelection||!this.RowSelection){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}var B=A.findParent('tr',false,true);var C=A.dom.cellIndex;var D=B.dom.rowIndex-1;if(this.CellSelection){this.fireEvent('celldblclick',this,A,D,C,e);}if(this.RowSelection){this.fireEvent('rowdblclick',this,B,D,e);}},sort:function(e,el){var A=Roo.get(el)if(!A.hasClass('sortable')){return;}var sort=A.attr('sort');var B='ASC';if(A.hasClass('glyphicon-arrow-up')){B='DESC';}
+this.maskEl=new Roo.LoadMask(this.el,{store:this.ds,msgCls:'roo-el-mask-msg'});this.store.on('load',this.onLoad,this);this.store.on('beforeload',this.onBeforeLoad,this);},onMouseover:function(e,el){var A=Roo.get(el);if(!A){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}var B=A.findParent('tr',false,true);var C=A.dom.cellIndex;var D=B.dom.rowIndex-1;this.fireEvent('mouseover',this,A,D,C,e);},onMouseout:function(e,el){var A=Roo.get(el);if(!A){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}var B=A.findParent('tr',false,true);var C=A.dom.cellIndex;var D=B.dom.rowIndex-1;this.fireEvent('mouseout',this,A,D,C,e);},onClick:function(e,el){var A=Roo.get(el);if(!A||(!this.CellSelection&&!this.RowSelection)){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}var B=A.findParent('tr',false,true);var C=A.dom.cellIndex;var D=B.dom.rowIndex-1;if(this.CellSelection){this.fireEvent('cellclick',this,A,D,C,e);}if(this.RowSelection){this.fireEvent('rowclick',this,B,D,e);}},onDblClick:function(e,el){var A=Roo.get(el);if(!A||(!this.CellSelection&&!this.RowSelection)){return;}if(e.getTarget().nodeName.toLowerCase()!='td'){A=A.findParent('td',false,true);}var B=A.findParent('tr',false,true);var C=A.dom.cellIndex;var D=B.dom.rowIndex-1;if(this.CellSelection){this.fireEvent('celldblclick',this,A,D,C,e);}if(this.RowSelection){this.fireEvent('rowdblclick',this,B,D,e);}},sort:function(e,el){var A=Roo.get(el)if(!A.hasClass('sortable')){return;}var sort=A.attr('sort');var B='ASC';if(A.hasClass('glyphicon-arrow-up')){B='DESC';}
 this.store.sortInfo={field:sort,direction:B};if(this.footer){Roo.log("calling footer first");this.footer.onClick('first');}else {this.store.load({params:{start:0}});}},renderHeader:function(){var A={tag:'thead',cn:[]};var cm=this.cm;for(var i=0,B=cm.getColumnCount();i<B;i++){var C=cm.config[i];var c={tag:'th',style:'',html:cm.getColumnHeader(i)};if(typeof(C.hidden)!='undefined'&&C.hidden){c.style+=' display:none;';}if(typeof(C.dataIndex)!='undefined'){c.sort=C.dataIndex;}if(typeof(C.sortable)!='undefined'&&C.sortable){c.cls='sortable';}if(typeof(C.width)!='undefined'){c.style+=' width:'+C.width+'px;';}
 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(){Roo.log('ds onload');this.clear();var A=this;var cm=this.cm;Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.removeClass(['glyphicon','glyphicon-arrow-up','glyphicon-arrow-down']);if(e.hasClass('sortable')&&e.attr('sort')==A.store.sortInfo.field&&A.store.sortInfo.direction.toUpperCase()=='ASC'){e.addClass(['glyphicon','glyphicon-arrow-up']);}if(e.hasClass('sortable')&&e.attr('sort')==A.store.sortInfo.field&&A.store.sortInfo.direction.toUpperCase()=='DESC'){e.addClass(['glyphicon','glyphicon-arrow-down']);}});var B=this.el.select('tbody',true).first();var C=[];if(this.store.getCount()>0){this.store.data.each(function(d,D){var E={tag:'tr',cn:[]};for(var i=0,F=cm.getColumnCount();i<F;i++){var G=cm.config[i];var H=cm.getRenderer(i);var I='';var id=Roo.id();if(typeof(H)!=='undefined'){I=H(d.data[cm.getDataIndex(i)],false,d);}if(typeof(I)==='object'){C.push({container:id,cfg:I})}var J={record:d,rowIndex:D,colIndex:i,rowClass:''}
 A.fireEvent('rowclass',this,J);var td={tag:'td',id:id,cls:J.rowClass,style:'',html:(typeof(I)==='object')?'':I};if(typeof(G.hidden)!='undefined'&&G.hidden){td.style+=' display:none;';}if(typeof(G.align)!='undefined'&&G.align.length){td.style+=' text-align:'+G.align+';';}if(typeof(G.width)!='undefined'){td.style+=' width:'+G.width+'px;';}
@@ -412,9 +412,9 @@ Roo.bootstrap.Graph=function(A){Roo.bootstrap.Graph.superclass.constructor.call(
 //Roo/bootstrap/dash/NumberBox.js
 Roo.bootstrap.dash=Roo.bootstrap.dash||{};Roo.bootstrap.dash.NumberBox=function(A){Roo.bootstrap.dash.NumberBox.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.dash.NumberBox,Roo.bootstrap.Component,{bgcolor:'aqua',headline:'',content:'',icon:'',footer:'',fhref:'',ficon:'',getAutoCreate:function(){var A={tag:'div',cls:'small-box bg-'+this.bgcolor,cn:[{tag:'div',cls:'inner',cn:[{tag:'h3',cls:'roo-headline',html:this.headline},{tag:'p',cls:'roo-content',html:this.content}]}]};if(this.icon){A.cn.push({tag:'div',cls:'icon',cn:[{tag:'i',cls:'ion '+this.icon}]});}if(this.footer){var footer={tag:'a',cls:'small-box-footer',href:this.fhref||'#',html:this.footer};A.cn.push(footer);}return A;},onRender:function(ct,A){Roo.bootstrap.dash.NumberBox.superclass.onRender.call(this,ct,A);},setHeadline:function(A){this.el.select('.roo-headline',true).first().dom.innerHTML=A;},setFooter:function(A,B){this.el.select('a.small-box-footer',true).first().dom.innerHTML=A;if(B){this.el.select('a.small-box-footer',true).first().attr('href',B);}},setContent:function(A){this.el.select('.roo-content',true).first().dom.innerHTML=A;},initEvents:function(){}});
 //Roo/bootstrap/dash/TabBox.js
-Roo.bootstrap.dash=Roo.bootstrap.dash||{};Roo.bootstrap.dash.TabBox=function(A){Roo.bootstrap.dash.TabBox.superclass.constructor.call(this,A);this.addEvents({"addpane":true});};Roo.extend(Roo.bootstrap.dash.TabBox,Roo.bootstrap.Component,{title:'',icon:false,getChildContainer:function(){return this.el.select('.tab-content',true).first();},getAutoCreate:function(){var A={tag:'li',cls:'pull-left header',html:this.title,cn:[]};if(this.icon){A.cn.push({tag:'i',cls:'fa '+this.icon});}var B={tag:'div',cls:'nav-tabs-custom',cn:[{tag:'ul',cls:'nav nav-tabs pull-right',cn:[A]},{tag:'div',cls:'tab-content no-padding',cn:[]}]};return B;},initEvents:function(){Roo.log('add add pane handler');this.on('addpane',this.onAddPane,this);},setTitle:function(A){this.el.select('.nav-tabs .header',true).first().dom.innerHTML=A;},onAddPane:function(A){Roo.log('addpane');Roo.log(A);var B=this.el.select('.nav-tabs',true).first();var C=B.select('.nav-tab',true);var D=C.getCount();;var E=B.createChild({tag:'li',cls:'nav-tab'+(D?'':' active'),cn:[{tag:'a',href:'#',html:A.title}]},D?C.first().dom:B.select('.header',true).first().dom);A.tab=E;E.on('click',this.onTabClick.createDelegate(this,[A],true));if(!D){A.el.addClass('active');}},onTabClick:function(ev,un,ob,A){Roo.log('tab - prev default');ev.preventDefault();this.el.select('.nav-tabs li.nav-tab',true).removeClass('active');A.tab.addClass('active');this.getChildContainer().select('.tab-pane',true).removeClass('active');A.el.addClass('active');A.fireEvent('activate');}});
+Roo.bootstrap.dash=Roo.bootstrap.dash||{};Roo.bootstrap.dash.TabBox=function(A){Roo.bootstrap.dash.TabBox.superclass.constructor.call(this,A);this.addEvents({"addpane":true});};Roo.extend(Roo.bootstrap.dash.TabBox,Roo.bootstrap.Component,{title:'',icon:false,getChildContainer:function(){return this.el.select('.tab-content',true).first();},getAutoCreate:function(){var A={tag:'li',cls:'pull-left header',html:this.title,cn:[]};if(this.icon){A.cn.push({tag:'i',cls:'fa '+this.icon});}var B={tag:'div',cls:'nav-tabs-custom',cn:[{tag:'ul',cls:'nav nav-tabs pull-right',cn:[A]},{tag:'div',cls:'tab-content no-padding',cn:[]}]};return B;},initEvents:function(){this.on('addpane',this.onAddPane,this);},setTitle:function(A){this.el.select('.nav-tabs .header',true).first().dom.innerHTML=A;},onAddPane:function(A){var B=this.el.select('.nav-tabs',true).first();var C=B.select('.nav-tab',true);var D=C.getCount();;var E=B.createChild({tag:'li',cls:'nav-tab'+(D?'':' active'),cn:[{tag:'a',href:'#',html:A.title}]},D?C.first().dom:B.select('.header',true).first().dom);A.tab=E;E.on('click',this.onTabClick.createDelegate(this,[A],true));if(!D){A.el.addClass('active');}},onTabClick:function(ev,un,ob,A){ev.preventDefault();this.el.select('.nav-tabs li.nav-tab',true).removeClass('active');A.tab.addClass('active');this.getChildContainer().select('.tab-pane',true).removeClass('active');A.el.addClass('active');A.fireEvent('activate');}});
 //Roo/bootstrap/dash/TabPane.js
-Roo.bootstrap.dash=Roo.bootstrap.dash||{};Roo.bootstrap.dash.TabPane=function(A){Roo.bootstrap.dash.TabPane.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.dash.TabPane,Roo.bootstrap.Component,{active:false,title:'',tab:false,getAutoCreate:function(){var A={tag:'div',cls:'tab-pane'};if(this.active){A.cls+=' active';}return A;},initEvents:function(){Roo.log('trigger add pane handler');this.parent().fireEvent('addpane',this)},setTitle:function(A){if(!this.tab){return;}
+Roo.bootstrap.dash=Roo.bootstrap.dash||{};Roo.bootstrap.dash.TabPane=function(A){Roo.bootstrap.dash.TabPane.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.dash.TabPane,Roo.bootstrap.Component,{active:false,title:'',tab:false,getAutoCreate:function(){var A={tag:'div',cls:'tab-pane'};if(this.active){A.cls+=' active';}return A;},initEvents:function(){this.parent().fireEvent('addpane',this)},setTitle:function(A){if(!this.tab){return;}
 this.title=A;this.tab.select('a'.true).first().dom.innerHTML=A;}});
 //Roo/bootstrap/menu/Menu.js
 Roo.bootstrap.menu=Roo.bootstrap.menu||{};Roo.bootstrap.menu.Menu=function(A){Roo.bootstrap.menu.Menu.superclass.constructor.call(this,A);this.addEvents({beforeshow:true,beforehide:true,show:true,hide:true,click:true});};Roo.extend(Roo.bootstrap.menu.Menu,Roo.bootstrap.Component,{submenu:false,html:'',weight:'default',icon:false,pos:'bottom',getChildContainer:function(){if(this.isSubMenu){return this.el;}return this.el.select('ul.dropdown-menu',true).first();},getAutoCreate:function(){var A=[{tag:'span',cls:'roo-menu-text',html:this.html}];if(this.icon){A.unshift({tag:'i',cls:'fa '+this.icon})}var B={tag:'div',cls:'btn-group',cn:[{tag:'button',cls:'dropdown-button btn btn-'+this.weight,cn:A},{tag:'button',cls:'dropdown-toggle btn btn-'+this.weight,cn:[{tag:'span',cls:'caret'}]},{tag:'ul',cls:'dropdown-menu'}]};if(this.pos=='top'){B.cls+=' dropup';}if(this.isSubMenu){B={tag:'ul',cls:'dropdown-menu'}}return B;},onRender:function(ct,A){this.isSubMenu=ct.hasClass('dropdown-submenu');Roo.bootstrap.menu.Menu.superclass.onRender.call(this,ct,A);},initEvents:function(){if(this.isSubMenu){return;}