Note that there are some explanatory texts on larger screens.

plurals
  1. POBackbone events firing multiple times even though I am following proper standards
    text
    copied!<p>I have a table that when I click on a row, in a side div I display the details. I have created an event on the row (tr) that is fired every time that row is clicked. The problem I have is that the event is being fired multiple times. It is acting as if a new view is being created everytime the event is fired, but a new view is not being created. Here is the code:</p> <pre><code>GroupView = class App.GroupView extends Backbone.View template: App.Utils.getTemplate 'group' selectedId: 0 events: 'click tr': 'selectGroup' selectGroup: (e) -&gt; thisEl = $(e.currentTarget) $(thisEl).closest('tr').siblings().removeClass 'selected' $(thisEl).closest('tr').addClass 'selected' @selectedId = $(thisEl).data().id @getGroupDetails @selectedId render: -&gt; $(@$el).html @template groups: @collection.models if @selectedId is 0 firstRowEl = $(@$el).find('tr:first') $(firstRowEl).addClass 'selected' @selectedId = $(firstRowEl).data().id @getGroupDetails @selectedId getGroupDetails: (id, platform) -&gt; $('&lt;img/&gt;', src: 'img/ajax_loader_2.gif' class: 'ajax-loader' ).appendTo '.group-details' renderGroupDetails id groupDetails = new GroupDetailsView el: '.group-details' model: groupDetailsModel renderGroupDetails = (id)-&gt; groupDetails.el = '.group-details' groupDetails.stopListening groupDetailsModel groupDetails.listenTo groupDetailsModel, 'change', -&gt; groupDetails.model = groupDetails: groupDetailsModel.toJSON() groupDetails.render() groupDetailsModel.fetch data: id: id processData: true </code></pre> <p>The issue is that when I use the <code>groupDetails.stopListening groupDetailsModel</code>, the multiple event firing issue is resolved but then NONE of the events in the <code>groupDetails</code> view is being fired.</p> <p>Any help is appreciated.</p> <p>Cheers,</p> <p>Kianosh</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload