[#116,view/grid][s]: do not show extra header col if no scrollbar on grid body.

This commit is contained in:
Rufus Pollock
2012-05-17 23:57:08 +01:00
parent d49956e4de
commit fa0f37b5f7
2 changed files with 7 additions and 2 deletions

View File

@@ -94,7 +94,7 @@ html>body thead.fixed-header tr {
/* set TBODY element to have block level attributes. All other non-IE browsers */ /* 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 */ /* 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 */ /* induced side effect is that child TDs no longer accept width: auto */
tbody.scrollContent { tbody.scroll-content {
display: block; display: block;
max-height: 500px; max-height: 500px;
overflow: auto; overflow: auto;

View File

@@ -167,7 +167,7 @@ my.Grid = Backbone.View.extend({
<th class="last-header" style="width: {{lastHeaderWidth}}px; padding: 0; margin: 0;"></th> \ <th class="last-header" style="width: {{lastHeaderWidth}}px; padding: 0; margin: 0;"></th> \
</tr> \ </tr> \
</thead> \ </thead> \
<tbody class="scrollContent"></tbody> \ <tbody class="scroll-content"></tbody> \
</table> \ </table> \
</div> \ </div> \
', ',
@@ -215,6 +215,11 @@ my.Grid = Backbone.View.extend({
}); });
newView.render(); 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)); this.el.find('.recline-grid').toggleClass('no-hidden', (self.state.get('hiddenFields').length === 0));
return this; return this;
}, },