Last active
December 13, 2015 17:59
-
-
Save linearshift/4952333 to your computer and use it in GitHub Desktop.
This file contains 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 sm_venues = Alloy.createCollection('sm_venues'); | |
//the local venues | |
var venues = Alloy.Collections.venues; | |
venues.comparator = function(model) { | |
return model.get('name'); | |
}; | |
venues.fetch(); | |
sm_venues.fetch({ | |
wait: true, | |
success : function(collection, resp) { | |
collection.each(function(theVenue){ | |
var newVenue = Alloy.createModel('venues', { | |
venues_id : theVenue.get('venues_id'), | |
page_id : theVenue.get('page_id'), | |
city : theVenue.get('city'), | |
country : theVenue.get('country'), | |
longitude : theVenue.get('longitude'), | |
latitude : theVenue.get('latitude'), | |
location : "",// theVenue.get('location'), | |
name : theVenue.get('name'), | |
state : theVenue.get('state'), | |
street : theVenue.get('street'), | |
zip : theVenue.get('zip'), | |
createddate : theVenue.get('createddate'), | |
lastmoddate : theVenue.get('lastmoddate') | |
}); | |
// add to the collection | |
venues.add(newVenue); | |
newVenue.save(); | |
}); | |
venues.fetch(); | |
Ti.API.info('|---> venues from database after feed ' + JSON.stringify(venues)); | |
}, | |
error : function(resp) { | |
Ti.API.info(' response ' + JSON.stringify(resp.toJSON())); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment