From fa0f37b5f7d3f7fb83bfd0f8d1f9a3e6b7ad3587 Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Thu, 17 May 2012 23:57:08 +0100 Subject: [PATCH] [#116,view/grid][s]: do not show extra header col if no scrollbar on grid body. --- css/grid.css | 2 +- src/view-grid.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/css/grid.css b/css/grid.css index 3d7d9b1a..a8ff0625 100644 --- a/css/grid.css +++ b/css/grid.css @@ -94,7 +94,7 @@ html>body thead.fixed-header tr { /* set TBODY element to have block level attributes. All other non-IE browsers */ /* this enables overflow to work on TBODY element. All other non-IE, non-Mozilla browsers */ /* induced side effect is that child TDs no longer accept width: auto */ -tbody.scrollContent { +tbody.scroll-content { display: block; max-height: 500px; overflow: auto; diff --git a/src/view-grid.js b/src/view-grid.js index eff00da6..f2a3bb2f 100644 --- a/src/view-grid.js +++ b/src/view-grid.js @@ -167,7 +167,7 @@ my.Grid = Backbone.View.extend({ \ \ \ - \ + \ \ \ ', @@ -215,6 +215,11 @@ my.Grid = Backbone.View.extend({ }); newView.render(); }); + // hide extra header col if no scrollbar to avoid unsightly overhang + var $tbody = this.el.find('tbody')[0]; + if ($tbody.scrollHeight <= $tbody.offsetHeight) { + this.el.find('th.last-header').hide(); + } this.el.find('.recline-grid').toggleClass('no-hidden', (self.state.get('hiddenFields').length === 0)); return this; },