Skip to content

Commit a6fbcbb

Browse files
committed
Grid Selecting: Add rows-selected status
1 parent 29ff084 commit a6fbcbb

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

grid-editing/grid-selectable.html

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,17 @@
5050
limit: 8
5151
}
5252
});
53-
var selected = [];
5453
developers.save = function() {
5554
store.save( localDevelopers );
5655
return this;
5756
}
57+
58+
var selected = [];
59+
// update status when selection changes
60+
$.observable( selected).bind( "insert remove", function() {
61+
$(".selected-status").text(selected.length);
62+
});
63+
5864
// TODO $.observable should support this binding, along with a less intrusive event facility
5965
function bindChange(index, developer) {
6066
$.observable( developer ).bind("change", function(event, ui) {
@@ -151,6 +157,7 @@
151157
var developer = $( this ).closest("tr").data( "grid-item" );
152158
$.each( selected, function( index, developer ) {
153159
$.observable( localDevelopers ).remove( developer );
160+
$.observable( selected ).remove( developer );
154161
});
155162
developers.refresh();
156163
});
@@ -199,6 +206,11 @@ <h2>local data source</h2>
199206
</thead>
200207
<tbody>
201208
</tbody>
209+
<tfoot>
210+
<tr>
211+
<td colspan="5"><span class="selected-status">0</span> row(s) selected</td>
212+
</tr>
213+
</tfoot>
202214
</table>
203215

204216
<div>

0 commit comments

Comments
 (0)