Skip to content

Instantly share code, notes, and snippets.

@jshirley
Created April 26, 2012 16:59
Show Gist options
  • Select an option

  • Save jshirley/2500965 to your computer and use it in GitHub Desktop.

Select an option

Save jshirley/2500965 to your computer and use it in GitHub Desktop.
initializer : function() {
var client = this.get('client'), list;
this.list = list = new ClientList({ client : client });
// If this view has a different client, set the list client.
// Inside of your ClientList, you probably want a bit of code that says
// after the clientChange there, load myself... like:
// this.after('clientChange', this.load, this);
this.on('clientChange', function () { list.set('client', e.newVal); });
// Then, when the ClientList is loaded, it will call render.
list.after('reset', this.render, this);
list.load(); // Initial loading
}
render : function() {
// Typical rendering, and now you can be sure that the ClientList is loaded
// (Unless something else is calling `render`)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment