From 6b77425421bc7e5edbac65bd51e036be4e7ca688 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 4 Sep 2020 14:44:07 +0800 Subject: [PATCH] bootstrap table height autoResize --- Roo/bootstrap/Table.js | 9 ++++++--- roojs-bootstrap-debug.js | 9 ++++++--- roojs-bootstrap.js | 2 +- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Roo/bootstrap/Table.js b/Roo/bootstrap/Table.js index fac3930db5..bed78c55db 100644 --- a/Roo/bootstrap/Table.js +++ b/Roo/bootstrap/Table.js @@ -1093,9 +1093,12 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component, { if (tbd) { - tbd.setSize(ctr.getWidth(), - ctr.getHeight() - ((thd ? thd.getHeight() : 0) + (tfd ? tfd.getHeight() : 0)) - ); + tbd.setWidth(ctr.getWidth()); + // if the body has a max height - and then scrolls - we should perhaps set up the height here + // this needs fixing for various usage - currently only hydra job advers I think.. + //tdb.setHeight( + // ctr.getHeight() - ((thd ? thd.getHeight() : 0) + (tfd ? tfd.getHeight() : 0)) + //); var barsize = (tbd.dom.offsetWidth - tbd.dom.clientWidth); cw -= barsize; } diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index 0ab5de6302..a42d64718d 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -7320,9 +7320,12 @@ Roo.extend(Roo.bootstrap.Table, Roo.bootstrap.Component, { if (tbd) { - tbd.setSize(ctr.getWidth(), - ctr.getHeight() - ((thd ? thd.getHeight() : 0) + (tfd ? tfd.getHeight() : 0)) - ); + tbd.setWidth(ctr.getWidth()); + // if the body has a max height - and then scrolls - we should perhaps set up the height here + // this needs fixing for various usage - currently only hydra job advers I think.. + //tdb.setHeight( + // ctr.getHeight() - ((thd ? thd.getHeight() : 0) + (tfd ? tfd.getHeight() : 0)) + //); var barsize = (tbd.dom.offsetWidth - tbd.dom.clientWidth); cw -= barsize; } diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 9316e297ec..80349e1611 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -295,7 +295,7 @@ for(var i=0,D=cm.getColumnCount();i tr',true).elements,function(el,C){if(el!=A){return; }B=C;});return B;},getGridEl:function(){return this.el;},autoSize:function(){var A=Roo.get(this.el.dom);var B=this.getGridEl().select('thead',true).first();var C=this.getGridEl().select('tbody',true).first();var D=this.getGridEl().select('tfoot',true).first(); -var cw=A.getWidth();if(C){C.setSize(A.getWidth(),A.getHeight()-((B?B.getHeight():0)+(D?D.getHeight():0)));var E=(C.dom.offsetWidth-C.dom.clientWidth);cw-=E;}cw=Math.max(cw,this.totalWidth);this.getGridEl().select('tr',true).setWidth(cw);return;},onBodyScroll:function(){if(this.mainHead){this.mainHead.setStyle({'position':'relative','left':(-1*this.mainBody.dom.scrollLeft)+'px'} +var cw=A.getWidth();if(C){C.setWidth(A.getWidth());var E=(C.dom.offsetWidth-C.dom.clientWidth);cw-=E;}cw=Math.max(cw,this.totalWidth);this.getGridEl().select('tr',true).setWidth(cw);return;},onBodyScroll:function(){if(this.mainHead){this.mainHead.setStyle({'position':'relative','left':(-1*this.mainBody.dom.scrollLeft)+'px'} );}if(this.lazyLoad){var A=this.mainBody.dom.scrollHeight;var B=Math.ceil(this.mainBody.getScroll().top);var C=this.mainBody.getHeight();if(A-C==B){var D=this.ds.getTotalCount();if(this.footer.cursor+this.footer.pageSize