Skip to content

Instantly share code, notes, and snippets.

@rafshar
Created January 9, 2012 01:55
Show Gist options
  • Save rafshar/1580553 to your computer and use it in GitHub Desktop.
Save rafshar/1580553 to your computer and use it in GitHub Desktop.
backbone view troubleshooting
App.Views.LayerGroupSelect = Backbone.View.extend({
tagName: 'li',
events: {
'click .group_header': 'toggleEnabled',
},
toggleEnabled: function() {
this.model.toggleEnabled();
},
initialize: function() {
console.log("initializing: " + this.model.get('name'))
this.model.bind('change', this.render, this);
},
render: function() {
console.log("rendering: " + this.model.get('name'))
$(this.el).html(ich.layer_group(this.model.toJSON(), true));
if (this.model.get("enabled")) {
$(this.el).addClass("layerEnabled");
} else {
$(this.el).removeClass("layerEnabled");
}
return this;
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment