Skip to content

Instantly share code, notes, and snippets.

@shinecita
Created September 6, 2012 20:15
Show Gist options
  • Save shinecita/3660067 to your computer and use it in GitHub Desktop.
Save shinecita/3660067 to your computer and use it in GitHub Desktop.
Show function that gives me the backbone object
, show: function (orgUserName) {
$('body').removeClass();
$('body').addClass('organizations');
var org = new Organization({id : orgUserName});
org.fetch();
var view = new OrganizationView({model: org});
Application.
trigger('showSidebar', view);
@shinecita
Copy link
Author

With findOrFetch

, show: function (orgUserName) {
$('body').removeClass();
$('body').addClass('organizations');

  var org = new Organization({id : orgUserName});

// org.fetch({success: function(){
// var view = new OrganizationView({model: org});
// Application.
// trigger('showSidebar', view);
// }
// });

console.log("Application.organizations", Application.organizations);     
Application.organizations.findOrFetch(orgUserName, function(err, model) {
    var view = new OrganizationView({model: model});
    Application.
      trigger('showSidebar', view);

});



}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment