From a7fcc817e87efee74d7957d62881129164d7c510 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 19 Jul 2021 11:49:42 +0800 Subject: [PATCH] table selection --- docs/src/Roo_bootstrap_Table.js.html | 11 +++++------ roojs-bootstrap-debug.js | 11 +++++------ roojs-bootstrap.js | 14 +++++++------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/docs/src/Roo_bootstrap_Table.js.html b/docs/src/Roo_bootstrap_Table.js.html index a59165bed1..8f5f4da8b9 100644 --- a/docs/src/Roo_bootstrap_Table.js.html +++ b/docs/src/Roo_bootstrap_Table.js.html @@ -494,16 +494,15 @@ var rowIndex = this.getRowIndex(row); // why??? - should these not be based on SelectionModel? - if(this.cellSelection){ + //if(this.cellSelection){ this.fireEvent('cellclick', this, cell, rowIndex, cellIndex, e); - } + //} - if(this.rowSelection){ + //if(this.rowSelection){ this.fireEvent('rowclick', this, row, rowIndex, e); - } + //} - - }, + }, onDblClick : function(e,el) { diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 0d7efc8c01..26788cc96c 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -8444,15 +8444,14 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component, { var rowIndex = this.getRowIndex(row); // why??? - should these not be based on SelectionModel? - if(this.cellSelection){ + //if(this.cellSelection){ this.fireEvent('cellclick', this, cell, rowIndex, cellIndex, e); - } + //} - if(this.rowSelection){ + //if(this.rowSelection){ this.fireEvent('rowclick', this, row, rowIndex, e); - } - - + //} + }, onDblClick : function(e,el) diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index b56cdcfc1c..cb3881c90c 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -344,13 +344,13 @@ this.fireEvent("header"+D,this,C,e);return;}if(e.getTarget().nodeName.toLowerCas var F=E.dom.rowIndex-1;if(E!==false){this.fireEvent("row"+A,this,F,e);if(B!==false){this.fireEvent("cell"+A,this,F,C,e);}}},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); -}if(!A||typeof(A)=='undefined'){return;}var B=A.findParent('tr',false,true);if(!B||typeof(B)=='undefined'){return;}var C=A.dom.cellIndex;var D=this.getRowIndex(B);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);}if(!A||typeof(A)=='undefined'){return;}var B=A.findParent('tr',false,true); -if(!B||typeof(B)=='undefined'){return;}var C=A.dom.cellIndex;var D=this.getRowIndex(B);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 B=A.attr('sort');var C='ASC';if(A.select('i',true).first().hasClass('fa-arrow-up')){C='DESC';}this.store.sortInfo={field:B,direction:C};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;this.totalWidth=0;for(var i=0,B=cm.getColumnCount();i';}if(typeof(C.mdHeader)!='undefined'){hh+=''; -}if(typeof(C.smHeader)!='undefined'){hh+='';}if(typeof(C.xsHeader)!='undefined'){hh+='';}if(hh.length){c.html=hh;}if(typeof(C.tooltip)!='undefined'){c.tooltip=C.tooltip; +}if(!A||typeof(A)=='undefined'){return;}var B=A.findParent('tr',false,true);if(!B||typeof(B)=='undefined'){return;}var C=A.dom.cellIndex;var D=this.getRowIndex(B);this.fireEvent('cellclick',this,A,D,C,e);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);}if(!A||typeof(A)=='undefined'){return;}var B=A.findParent('tr',false,true);if(!B||typeof(B)=='undefined'){return;}var C=A.dom.cellIndex; +var D=this.getRowIndex(B);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 B=A.attr('sort'); +var C='ASC';if(A.select('i',true).first().hasClass('fa-arrow-up')){C='DESC';}this.store.sortInfo={field:B,direction:C};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;this.totalWidth=0;for(var i=0,B=cm.getColumnCount();i';}if(typeof(C.mdHeader)!='undefined'){hh+='';} +if(typeof(C.smHeader)!='undefined'){hh+='';}if(typeof(C.xsHeader)!='undefined'){hh+='';}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(E){if(typeof(C[E])=='undefined'){return; }if(!C[E]){c.cls+=' hidden-'+E+' hidden'+E+'-down';return;}c.cls+=' col-'+E+'-'+C[E]+(E=='xs'?(' col-'+C[E]):'');});A.cn.push(c)}return A;},renderBody:function(){var A={tag:'tbody',cn:[{tag:'tr',cn:[{tag:'td',colspan:this.cm.getColumnCount()}]}]};return A; -- 2.39.2