Skip to content

Commit fbdc928

Browse files
committed
Grid SPF: Add refresh button and loading-indicator overlay
1 parent f353c4e commit fbdc928

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

grid-spf/menugrid.html

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,28 @@
4242
movies.option("paging.limit", +$(this).val()).refresh();
4343
});
4444

45+
$("#refresh").button({
46+
icons: {
47+
primary: "ui-icon-refresh"
48+
}
49+
}).click(function() {
50+
movies.refresh();
51+
})
52+
4553
$( "#pager" ).pager({
4654
source: movies
4755
});
4856

57+
var overlay = $( "<div id='loading-overlay'>" )
58+
.addClass( "ui-widget-overlay" )
59+
.hide()
60+
.appendTo( "body" );
61+
$( movies ).bind( "datasourcerequest", function() {
62+
overlay.show();
63+
}).bind( "datasourceresponse", function() {
64+
overlay.hide();
65+
});
66+
4967
movies.refresh();
5068
});
5169
</script>
@@ -87,14 +105,17 @@ <h2>Movies! Click header for sort menu, use inputs for filtering, pager for pagi
87105
</tbody>
88106
<tfoot>
89107
<tr>
90-
<td id="pager" class="ui-state-default">
91-
<button data-page="first">First</button>
92-
<button data-page="prev">Prev</button>
93-
<span>
94-
Page <input class="current" size="4"/> of <span class="total">0</span>
108+
<td class="ui-state-default">
109+
<button id="refresh">Refresh</button>
110+
<span id="pager">
111+
<button data-page="first">First</button>
112+
<button data-page="prev">Prev</button>
113+
<span>
114+
Page <input class="current" size="4"/> of <span class="total">0</span>
115+
</span>
116+
<button data-page="next">Next</button>
117+
<button data-page="last">Last</button>
95118
</span>
96-
<button data-page="next">Next</button>
97-
<button data-page="last">Last</button>
98119
</td>
99120
<td class="ui-state-default">
100121
<label for="pagesize">Pagesize</label>

0 commit comments

Comments
 (0)