blob: 1563094373df692563f6d6cead5a4fccac2016da [file] [log] [blame]
Scott Baker329d3622014-07-15 13:57:34 -07001// helloworld.js
2function updateHelloWorldData() {
3 var html = "<table class='table table-bordered table-striped'>";
4 for (var slicekey in xos.slices.models) {
5 slice = xos.slices.models[slicekey]
6 html = html + "<tr><td>" + slice.get("name") + "</td><td>" + slice.get("description") + "</td></tr>";
7 }
8 html = html + "</table>";
9 $('#dynamicTableOfInterestingThings').html(html);
10}
11
12$(document).ready(function(){
13 xos.slices.on("change", function() { updateHelloWorldData(); });
14 xos.slices.on("remove", function() { updateHelloWorldData(); });
15 xos.slices.on("sort", function() { updateHelloWorldData(); });
16
17 xos.slices.startPolling();
18});
19
20// helloworld.js
21$(document).ready(function() {
22 $('#submitNewDescription').bind('click', function() {
23 newDescription = $("#newDescription").val();
24 xos.slices.models[0].set("description", newDescription);
25 xos.slices.models[0].save();
26 });
27});