Mohamad Khoder
Mohamad Khoder

Reputation: 1

Exception from Tracker recompute function: ReferenceError: $el is not defined

i am following the following error when trying to filter the images posted by a certain user the error :

Exception from Tracker recompute function:
meteor.js?hash=857dafb4b9dff17e29ed8498a22ea5b1a3d6b41d:1059 ReferenceError: $el is not defined
    at destroyApi (stars_rating.js:98)
    at Blaze.TemplateInstance.Template.starsRating.destroyed (stars_rating.js:132)
    at template.js:124
    at Function.Template._withTemplateInstanceFunc (template.js:493)
    at fireCallbacks (template.js:120)
    at Blaze.View.<anonymous> (template.js:226)
    at fireCallbacks (view.js:276)
    at Object.Tracker.nonreactive (tracker.js:603)
    at view.js:273
    at Object.Blaze._withCurrentView (view.js:533)

find here the js click event i wrote when clicking on the user username :

'click .js-set-image-filter': function(event){
        Session.set("userFilter", this.createdBy);
    }

find here the template helper code:

images: function(){
    
    if(Session.get("userFilter")){
        return TasksCollection.find({createdBy:Session.get("userFilter")},{sort :{cretedOn:-1 ,rating:-1}});
    }
    else{
        return TasksCollection.find({},{sort :{cretedOn:-1 ,rating:-1}});
    }
},

find here the template code:

<template name="hello"> 
    {{#if currentUser}}
    <button class="js-show-image-form btn btn-success">show</button>
    {{/if}}
    <div class="row">
        {{#each images}}
        <div class="col-xs-6 col-md-3" id="{{_id}}">
            <div class="thumbnail">
                <img class="js-image crop-img" src="{{img_src}}" alt="{{imd_alt}}"/>
                <div class="caption">
                    <h3>Rating : {{rating}}</h3>
                    <p>{{imd_alt}}</p>
                    <p> User: 
                        <a href="#" class="js-set-image-filter"> {{getUser createdBy}} </a>
                    </p>
                    <p> {{>starsRating mutable=true class="js-rate-image" id=_id}}</p>
                    <button class="js-del-image btn btn-warning">Delete</button>
                </div>
            </div>
        </div>
        {{/each}}
    </div>
</template>

Upvotes: 0

Views: 141

Answers (1)

AugustusJames
AugustusJames

Reputation: 1

I have figured out half of this, but I'm not sure how to completely fix it. The Exception from Tracker error is caused by using '#' inside the href of <a href="" class="js-set-image-filter">{{getUser createdBy}} . Now when I click a user my page flashes and resets to all images, which seems to be another issue altogether.

Upvotes: 0

Related Questions