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

  • SEARCH
  • Home
  • 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 8400067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:28:11+00:00 2026-06-09T21:28:11+00:00

I have a backbone view that is initialized via route, but i when i

  • 0

I have a backbone view that is initialized via route, but i when i navigate to another route and return to the previous one again via link, the events in the view get fired twice
Heres my router

define(['underscore','backbone','views/projects/view_project',
    'views/projects/project_tasks','views/projects/project_milestones',
    'views/projects/project_tasklists','views/projects/project_documents'
    ],
    function( _,Backbone,ProjectTasks,ProjectMilestones,
        ProjectTasklists,ProjectDocuments) {

    var ProjectRouter = Backbone.Router.extend({
        initialize: function(projects) {
            if(projects) {
                this.projects = projects;
            }
        },
        //url routes mapped to methods
        routes: {
            "project/:id":"get_project",
            "project/:id/milestones":"get_project_milestones",
            "project/:id/tasks":"get_project_tasks",
            "project/:id/tasklists":"get_project_tasklists",
            "project/:id/documents":"get_project_documents"
        },

        get_project: function(id) {
            UberERP.UI.loadpage("#project-view");
            var project_view = new ProjectView(this.projects,id);
        },

        get_project_tasks: function(id) {
            UberERP.UI.loadpage("#project-tasks-view");
            var project_tasks_view = new ProjectTasks(id,this.projects);
        },

        get_project_tasklists: function(id) {
            UberERP.UI.loadpage("#project-tasklist-view");
            var project_tasks_view = new ProjectTasklists(id,this.projects);
        },

        get_project_milestones: function(id) {
            UberERP.UI.loadpage("#project-milestones-view");
            var project_milestones_view = new ProjectMilestones(id,this.projects);
        },

        get_project_documents: function(id) {
            UberERP.UI.loadpage("#project-documents-view");
            var project_documents_view = new ProjectDocuments(id,this.projects);
        }
    });

    return ProjectRouter;
});

and a snipper from the view

events: {
          "click input[name=task]":"select_task",
          "click a.remove-icon":"remove_task",
          "click td.view-task":"view_task",
          "click #project-tasks-table .sort-by-status":"sort_by_status",
          "click #project-tasks-table .group-filter-btn":"sort_by_task_list"
        },

select_task: function( event ) {
            var el = $(event.currentTarget);
            row = el.parent('td').parent('tr');
            console.log(el.val());
            if(row.hasClass('active')) {
                row.removeClass('active');
            }
            else {
                row.addClass('active');
            }
        }

I have a line in the select_task method that logs the value of the clicked input element.
When the view is initially called it works properly and logs to the console. But after navigating to another route and returning back, the value of the input element is logged twice when clicked. What could be wrong?

  • 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-09T21:28:12+00:00Added an answer on June 9, 2026 at 9:28 pm

    I think you just find your self in the middle of a Backbone ghost View issue.

    Try to remove and unbind all your Views when you are moving from one route to another.

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

Sidebar

Related Questions

I'm having an issue with backbone.js' models. I have a view that creates another
I have backbone view that binds an action to an element in the DOM.
I have a Backbone View that has a Collection as its Model. If the
In my Backbone application I have a main view that shows previews of posts.
I have created a street view backbone view. The problem is that when shown,
I have a standard list view setup with backbone that looks something like below.
I have two backbone Views. One is the main view and the other is
I have a Backbone View for a general element that specific elements will be
I have a backbone view that calls to a sub-view: lr.MapView = Backbone.View.extend({ el:
I have a backbone app with a view structure that looks like the following

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.