Skip to content

Instantly share code, notes, and snippets.

@nicholasjhenry
Created January 12, 2012 16:51
Show Gist options
  • Select an option

  • Save nicholasjhenry/1601567 to your computer and use it in GitHub Desktop.

Select an option

Save nicholasjhenry/1601567 to your computer and use it in GitHub Desktop.
Sproutcore Statechart
TwitterBrowser.EnterUserNameView = SC.TextField.extend({
insertNewline: function() {
TwitterBrowser.statechart.sendEvent('searchForUser', this.get('value'));
}
});
TwitterBrowser.statechart = SC.Statechart.create({
searchForUser: function(userName) {
var recordArray = TwitterBrowser.store.find(
SC.Query.local(TwitterBrowser.User, "userName ='" + userName + "'", {userName: userName}));
TwitterBrowser.UsersController.set('content', recordArray);
this.gotoState('displayUserProfile');
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment