Skip to content

Commit 80174a5

Browse files
committed
Made the larger grid resizable
1 parent af3743a commit 80174a5

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

grid-markup/grid.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
/*
66
Functional
77
*/
8+
.ui-grid .ui-grid-body {
9+
overflow: auto;
10+
}
811
.ui-grid .ui-grid-head-table, .ui-grid .ui-grid-body-table {
912
border-collapse: collapse;
1013
table-layout: fixed;

grid-markup/grid.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
<script src="../jquery-1.4.4.js"></script>
1010
<script src="../ui/jquery.ui.core.js"></script>
1111
<script src="../ui/jquery.ui.widget.js"></script>
12+
<script src="../ui/jquery.ui.mouse.js"></script>
13+
<script src="../ui/jquery.ui.resizable.js"></script>
1214
<script src="grid.js"></script>
13-
<style>
14-
.ui-grid-body {
15-
height: 150px;
16-
overflow: auto;
17-
}
18-
</style>
1915
<script>
2016
$(function() {
2117
$( "#dataTable1" ).grid();
22-
$( "#dataTable2" ).grid();
18+
$( "#dataTable2" ).grid().grid("widget").resizable({
19+
resize: function() {
20+
$(this).find(".ui-grid-body").height( $(this).height() - $(this).find(".ui-grid-head").height() - 20 );
21+
}
22+
}).find(".ui-grid-body").height(300);
2323
});
2424
</script>
2525
</head>

grid-markup/grid.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ $.widget( "ui.grid", {
7777
this.refresh();
7878

7979
},
80+
81+
widget: function() {
82+
return this.uiGrid;
83+
},
84+
8085
refresh: function() {
8186
// Adjust head in case of visible scrollbar on body to keep columns aligned
8287
var vertScrollbar = ( this.uiGridBody[0].scrollHeight !== this.uiGridBody[0].clientHeight );

0 commit comments

Comments
 (0)