Skip to content

Commit fe95250

Browse files
committed
Added a footer, touched up the fluid resize
1 parent b34fd00 commit fe95250

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

grid-markup/grid.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
resize: function() {
2020
$(this).find(".ui-grid-body-table").grid("refresh");
2121
}
22-
}).height(300);
22+
}).height(300).find(".ui-grid-foot").height(20);
2323
$( "#dataTable2" ).grid( "refresh" );
2424
});
2525
</script>

grid-markup/grid.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ $.widget( "ui.grid", {
2323
.appendTo( uiGrid ),
2424
uiGridBody = ( this.uiGridBody = $("<div class='ui-widget-content ui-grid-body'></div>") )
2525
.appendTo( uiGrid ),
26+
uiGridFoot = ( this.uiGridFoot = $("<div class='ui-widget-header ui-grid-foot'></div>") )
27+
.appendTo( uiGrid ),
2628

2729
// New table in grid head for column headers
2830
uiGridHeadTable = ( this.uiGridHeadTable = $("<table class='ui-grid-head-table'></table>") )
@@ -83,18 +85,21 @@ $.widget( "ui.grid", {
8385
},
8486

8587
refresh: function() {
88+
var gridHeight = this.uiGrid.height(),
89+
headHeight = this.uiGridHead.height(),
90+
footHeight = this.uiGridFoot.height();
91+
92+
// Adjust body height to fill
93+
this.uiGridBody.height( gridHeight - headHeight - footHeight );
94+
8695
// Adjust head in case of visible scrollbar on body to keep columns aligned
8796
var vertScrollbar = ( this.uiGridBody[0].scrollHeight !== this.uiGridBody[0].clientHeight );
8897
if ( vertScrollbar ) {
8998
this.uiGridHead.css("padding-right", ( this.uiGridBody.width() - this.uiGridBodyTable.width() ) + "px" );
9099
} else {
91100
this.uiGridHead.css("padding-right", 0);
92101
}
93-
// Adjust body height to fill
94-
// TODO: create footer and calculate height
95-
// ... in the meantime, fax it
96-
var gridFootHeight = 20;
97-
this.uiGridBody.height( this.uiGrid.height() - this.uiGridHead.height() - gridFootHeight )
102+
98103
}
99104
});
100105

0 commit comments

Comments
 (0)