Created
December 13, 2010 11:18
-
-
Save balinterdi/738906 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var w = Ti.UI.currentWindow, | |
| Bubbles = Ti.App.Bubbles; | |
| var DescribePage = { | |
| taxonomyController: function({ | |
| view: Ti.UI.createTableView({}), | |
| // handle different kind of changes (changeGender, changeCategory, etc.) here? | |
| })(), | |
| createRowForTaxonomyClass: function(klass, value) { | |
| var row = Ti.UI.createTableViewRow(); | |
| }, | |
| populateView: function() { | |
| var page = this; | |
| Bubbles.network.client.onload = function() { | |
| var rows = []; | |
| var taxonomyClasses = JSON.parse(this.responseData); | |
| var couchDBInternals = ['_id', '_rev']; | |
| for (var klass in taxonomyClasses) { | |
| if ( couchDBInternals.indexOf(klass) == -1 ) { | |
| var row = page.createRowForTaxonomyClass(klass, taxonomyClasses[klass]); | |
| rows.push(row); | |
| } | |
| } | |
| page.taxonomyController.setData(rows); | |
| }; | |
| Bubbles.network.client.onerror = function() { | |
| alert('Error while loading description data.'); | |
| }; | |
| Bubbles.network.client.open('GET', Bubbles.getAPIUrl('/products/taxonomy')); | |
| Bubbles.network.client.send(); | |
| } | |
| }; | |
| DescribePage.show(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment