Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9070109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:36:15+00:00 2026-06-16T17:36:15+00:00

I am seeing some weird behaviour in my Backbone view. When i console.log this.model

  • 0

I am seeing some weird behaviour in my Backbone view. When i console.log “this.model” i get different results in my render method and in one of my custom methods.

This is how i have my route set up:

app_router.on('route:showTemplates', function(id) {
                var listtemplate = new ListTemplateModel.Model({
                    id: id
                });
                listtemplate.fetch().then(function() {
                    var detailsview = new ListDetailsView.View({
                        model: listtemplate
                    });
                });
            });

If I console.log in the render method of my view, i get what i expect:

define(['use!backbone', 'helpers/templateHelper'], function(B, TemplateHelper) {
    var View = B.View.extend({
        el: '#page',
        template: TemplateHelper('taskDetailTemplate'),
        events: {
            'keypress #new-step': 'addOnEnter'
        },
        initialize: function() {
            this.render();
        },
        render: function() {
            this.$el.html(this.template(this.model.toJSON()));
        },
        addOnEnter: function(e) {
             this.input = this.$('#new-step');

            if (e.which !== 13) {// || !this.input.val().trim()) {
                return;
            }
            console.log(this.model.toJSON());           
        }
    });

    return {
        View: View
    };
});

But the console.log in my “addOnEnter” method returns an array of all the model instances that were created over a session. Its like the event gets fired for all the previously created models too.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:36:17+00:00Added an answer on June 16, 2026 at 5:36 pm

    This was being caused because the event was getting fired multiple times for all the elements in the collection like it is mentioned here. It just manifested itself in a different way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm seeing some weird behaviour debugging my C# code - I cant post my
I'm seeing some weird behaviour that I wasn't expecting. On a pure white matrix
We are using the image resizer from imageresizing.net and are seeing some weird behaviour.
I'm seeing some weird stuff happening in my app. After coming back to the
I'm seeing a weird error message and am looking for some ideas as to
This is really a two part question: I'm seeing some users in the Grantee
I have this problem in my ASP.NET application where I'm seeing some of my
I'm implementing drag & drop from a ListBox, but I'm seeing some strange behaviour
I'm seeing inconsistent behaviour when calling setResult() and finish() on some activities that were
I'm seeing some weird behavior in php when comparing a double to a string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.