Create a Backgrid populated with data from Parse.com and have it auto save back to Parse when a field is edited:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
//load my Parse.com Class called "parts" var Part = Parse.Object.extend("parts", { //save the data back to parse.com when it changes initialize: function() { Parse.Object.prototype.initialize.apply(this,arguments); this.on("change", function (model,options) { if (options && options.save === false) return; model.save() }); } }); var Parts = Parse.Collection.extend({ model: Part }); var columns = [{ name: "id", label: "ID", editable: false, // By default every cell in a column is editable, but *ID* shouldn't be cell: Backgrid.IntegerCell.extend({ orderSeparator: '' }) }, { name: "name", label: "Name", cell: "string" }, { name: "description", label: "description", cell: "string" }]; var parts = new Parts(); // Initialize a new Grid instance var grid = new Backgrid.Grid({ columns: columns, collection: parts }); // Render the grid and attach the root to your HTML document $("#results-grid").append(grid.render().el); // Fetch some countries from the url parts.fetch({reset: true}); |
Did you find this post useful?
Tip me some bitcoin: