Skip to content

Commit 1554074

Browse files
committed
Grid: added heightStyle option, defaults to auto so grid grows and shrinks to fit rows as they're added and removed.
1 parent 683ed79 commit 1554074

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

grid-spf/grid.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
});
8787

8888
$( "#developers-local" ).grid({
89+
heightStyle: "fill",
8990
source: developers.result,
9091
select: function( event, ui ) {
9192
console.log( "Selected " + ui.item.firstName );

ui/jquery.ui.grid.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
$.widget( "ui.grid", {
1414

1515
options: {
16-
dataFields: [ "type", "editor", "editorOptions", "template", "culture", "format" ],
1716
columns: null,
17+
dataFields: [ "type", "editor", "editorOptions", "template", "culture", "format" ],
18+
heightStyle: "auto",
1819
rowTemplate: null
1920
},
2021

@@ -200,8 +201,10 @@ $.widget( "ui.grid", {
200201
this.uiGrid.removeClass( "ui-grid-resizable" );
201202
}
202203

203-
// Adjust body height to fill
204-
this.uiGridBody.height( gridHeight - headHeight - footHeight );
204+
if ( this.options.heightStyle === "fill" ) {
205+
// Adjust body height to fill
206+
this.uiGridBody.height( gridHeight - headHeight - footHeight );
207+
}
205208

206209
// Adjust head and foot in case of visible scrollbar on body to keep columns aligned
207210
var paddingRight,

0 commit comments

Comments
 (0)