From bd7af43f35926a6ea5c534df09fc1495670aeaaa Mon Sep 17 00:00:00 2001 From: leon Date: Wed, 30 Nov 2022 15:54:32 +0800 Subject: [PATCH] roojs-bootstrap.js roojs-bootstrap-debug.js --- roojs-bootstrap-debug.js | 52 ++++++++++++++-------------------------- roojs-bootstrap.js | 13 +++++----- 2 files changed, 24 insertions(+), 41 deletions(-) diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 5b7a162563..49b7888863 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -9418,14 +9418,10 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component, { cfg.cn.push(this.renderBody()); - if(this.footerShow){ + if(this.footerShow || this.summaryFooterShow){ cfg.cn.push(this.renderFooter()); } - if(!this.footerShow && this.summaryFooterShow) { - cfg.cn.push(this.renderSummaryFooter()); - } - // where does this come from? //cfg.cls+= ' TableGrid'; } @@ -9985,32 +9981,6 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component, { return footer; }, - - renderSummaryFooter : function() - { - var footer = { - tag: 'tfoot', - cn : [] - }; - - var cm = this.cm; - - for(var i = 0, len = cm.getColumnCount(); i < len; i++){ - - var c = { - tag: 'td', - cls : 'x-fcol-' + i, - style : '', - html: '' - }; - - footer.cn.push(c) - } - - return footer; - }, - - onLoad : function() { @@ -10040,9 +10010,6 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component, { if(ds.getCount() > 0){ ds.data.each(function(d,rowIndex){ var row = this.renderRow(cm, ds, rowIndex); - - Roo.log("ROW"); - Roo.log(row); tbody.createChild(row); @@ -10074,12 +10041,29 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component, { if(!this.footerShow && this.summaryFooterShow) { + var tr = { + tag : 'tr', + cn : [] + }; + for(var i = 0, len = cm.getColumnCount(); i < len; i++){ var value = cm.config[i].summaryFooter; Roo.log('value [' + i + '] : ' + value); + + var td = { + tag: 'td', + cls : ' x-fcol-' + i, + style: '', + html: cm.config[i].summaryFooter + }; + + tr.cn.push(td); + } + + tfoot.createChild(row); } Roo.each(this.el.select('tbody td', true).elements, function(e){ diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 40fcfa5cdb..e2d0d8d340 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -398,8 +398,8 @@ this.ds=this.store;this.ds.xmodule=this.xmodule||false;}if(this.footer&&this.sto );};Roo.extend(Roo.bootstrap.Table,Roo.bootstrap.Component,{cls:false,empty_results:'',striped:false,scrollBody:false,bordered:false,hover:false,condensed:false,responsive:false,sm:false,cm:false,store:false,loadMask:false,footerShow:true,summaryFooterShow:false,headerShow:true,enableColumnResize:true,disableAutoSize:false,rowSelection:false,cellSelection:false,layout:false,minColumnWidth:50,bodyEl:false,headEl:false,resizeProxy:false,container:false,lazyLoad:false,CSS:Roo.util.CSS,auto_hide_footer:false,view:false,getAutoCreate:function(){var A=Roo.apply({} ,Roo.bootstrap.Table.superclass.getAutoCreate.call(this));A={tag:'table',cls:'table',cn:[]};if(this.scrollBody){A.cls+=' table-body-fixed';}if(this.striped){A.cls+=' table-striped';}if(this.hover){A.cls+=' table-hover';}if(this.bordered){A.cls+=' table-bordered'; }if(this.condensed){A.cls+=' table-condensed';}if(this.responsive){A.cls+=' table-responsive';}if(this.cls){A.cls+=' '+this.cls;}if(this.layout){A.style=(typeof(A.style)=='undefined')?('table-layout:'+this.layout+';'):(A.style+('table-layout:'+this.layout+';')); -}if(this.store||this.cm){if(this.headerShow){A.cn.push(this.renderHeader());}A.cn.push(this.renderBody());if(this.footerShow){A.cn.push(this.renderFooter());}if(!this.footerShow&&this.summaryFooterShow){A.cn.push(this.renderSummaryFooter());}}return {cn:[A]} -;},initEvents:function(){if(!this.store||!this.cm){return;}if(this.selModel){this.selModel.initEvents();}this.bodyEl=this.el.select('tbody',true).first();this.headEl=this.el.select('thead',true).first();this.mainFoot=this.el.select('tfoot',true).first();Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.on('click',this.sort,this); +}if(this.store||this.cm){if(this.headerShow){A.cn.push(this.renderHeader());}A.cn.push(this.renderBody());if(this.footerShow||this.summaryFooterShow){A.cn.push(this.renderFooter());}}return {cn:[A]};},initEvents:function(){if(!this.store||!this.cm){return; +}if(this.selModel){this.selModel.initEvents();}this.bodyEl=this.el.select('tbody',true).first();this.headEl=this.el.select('thead',true).first();this.mainFoot=this.el.select('tfoot',true).first();Roo.each(this.el.select('thead th.sortable',true).elements,function(e){e.on('click',this.sort,this); },this);if(this.footer){this.footer.parentId=this.id;this.footer.onRender(this.el.select('tfoot tr td').first(),null);if(this.lazyLoad){this.el.select('tfoot tr td').first().addClass('hide');}}if(this.loadMask){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);this.store.on('update',this.onUpdate,this);this.store.on('add',this.onAdd,this);this.store.on("clear",this.clear,this);this.el.on("contextmenu",this.onContextMenu,this); this.cm.on("headerchange",this.onHeaderChange,this);this.cm.on("hiddenchange",this.onHiddenChange,this,arguments);this.bodyEl.on("click",this.onClick,this);this.bodyEl.on("dblclick",this.onDblClick,this);this.bodyEl.on('scroll',this.onBodyScroll,this);this.relayEvents(this.bodyEl,["mousedown","mouseup","mouseover","mouseout","keypress"]); @@ -424,12 +424,11 @@ var c={tag:'th',cls:'x-hcol-'+i,style:'',html:cm.getColumnHeader(i)};var D=cm.ge }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.dataIndex)!='undefined'){c.sort=C.dataIndex;}if(typeof(C.align)!='undefined'&&C.align.length){c.style+=' text-align:'+C.align+';'; }if(typeof(C.cls)!='undefined'){c.cls=(typeof(c.cls)=='undefined')?C.cls:(c.cls+' '+C.cls);}if(this.responsive){['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]):''); });}c.html+=' ';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;},renderSummaryFooter:function(){var A={tag:'tfoot',cn:[]};var cm=this.cm;for(var i=0,B=cm.getColumnCount();i0){ds.data.each(function(d,G){var H=this.renderRow(cm,ds,G); -Roo.log("ROW");Roo.log(H);B.createChild(H);var I=this;if(H.cellObjects.length){Roo.each(H.cellObjects,function(r){I.renderCellObject(r);})}},this);}else if(this.empty_results.length){this.el.mask(this.empty_results,'no-spinner');}var C=this.el.select('tfoot',true).first(); -if(this.footerShow&&this.auto_hide_footer&&this.mainFoot){this.mainFoot.setVisibilityMode(Roo.Element.DISPLAY).hide();var D=this.ds.getTotalCount();if(this.footer.pageSize 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.bodyEl.dom;for(var i=0;i