Skip to content

Commit f353c4e

Browse files
committed
Grid SPF: Fix pager on menugrid demo. Add select for pagesize (limit option)
1 parent 3648b51 commit f353c4e

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

grid-spf/menugrid.html

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
}
3939
}).menugrid();
4040

41+
$("#pagesize").change(function() {
42+
movies.option("paging.limit", +$(this).val()).refresh();
43+
});
44+
4145
$( "#pager" ).pager({
4246
source: movies
4347
});
@@ -52,6 +56,9 @@
5256
tfoot td {
5357
text-align: center;
5458
}
59+
#movies {
60+
width: 800px;
61+
}
5562
</style>
5663
</head>
5764
<body>
@@ -71,16 +78,16 @@ <h2>Movies! Click header for sort menu, use inputs for filtering, pager for pagi
7178
<table id="movies">
7279
<thead>
7380
<tr>
74-
<th data-property="Name" data-type="string">Name</th>
75-
<th data-property="ReleaseYear" data-type="number">Release Year</th>
76-
<th data-property="AverageRating" data-type="number">Average Rating</th>
81+
<th width="600" data-property="Name" data-type="string">Name</th>
82+
<th width="100" data-property="ReleaseYear" data-type="number">Release Year</th>
83+
<th width="100" data-property="AverageRating" data-type="number">Average Rating</th>
7784
</tr>
7885
</thead>
7986
<tbody>
8087
</tbody>
8188
<tfoot>
8289
<tr>
83-
<td id="pager" colspan="2" class="ui-state-default">
90+
<td id="pager" class="ui-state-default">
8491
<button data-page="first">First</button>
8592
<button data-page="prev">Prev</button>
8693
<span>
@@ -89,7 +96,17 @@ <h2>Movies! Click header for sort menu, use inputs for filtering, pager for pagi
8996
<button data-page="next">Next</button>
9097
<button data-page="last">Last</button>
9198
</td>
92-
<td class="ui-state-default">Viewing rows <span class="paging-from">0</span> to <span class="paging-to">0</span> of <span class="paging-total">0</span>
99+
<td class="ui-state-default">
100+
<label for="pagesize">Pagesize</label>
101+
<select id="pagesize">
102+
<option>10</option>
103+
<option>20</option>
104+
<option>30</option>
105+
</select>
106+
</td>
107+
<td class="ui-state-default">
108+
Viewing rows <span class="paging-from">0</span> to <span class="paging-to">0</span> of <span class="paging-total">0</span>
109+
</td>
93110
</tr>
94111
</tfoot>
95112
</table>

grid-spf/menugrid.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $.widget("spf.menugrid", {
1818
});
1919

2020
var thead = this.element.find( "thead" );
21-
thead.children()
21+
var inputs = thead.children()
2222
.clone()
2323
.insertAfter( thead )
2424
.find( "th" )
@@ -27,7 +27,7 @@ $.widget("spf.menugrid", {
2727
$( "<input>" ).appendTo( $( this ).empty() );
2828
});
2929

30-
this.element.find( "input" ).bind( "change", function() {
30+
inputs.find( "input" ).bind( "change", function() {
3131
var head = $( this ).parent(),
3232
field = head.data( "field" ),
3333
type = head.data( "type" ),

0 commit comments

Comments
 (0)