window.RoomsView = Backbone.View.extend({ initialize: function() { this.collection.bind('reset', this.render, this); }, render: function() { this.template = Handlebars.compile($("#room-tabs-template").html()); var rooms = {'rooms': this.collection.toJSON()}; $('#room-tabs').html(this.template(rooms)).tabs(); if(typeof(window.roomTabsId) != "undefined") { $('#room-tabs').tabs('select', window.roomTabsId); } return this; } });