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 8628551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:34:27+00:00 2026-06-12T08:34:27+00:00

Possible Duplicate: Call methods of different views in Backbone.js I am new to backbone.js

  • 0

Possible Duplicate:
Call methods of different views in Backbone.js

I am new to backbone.js and I am using backbone.js with ASP.NET MVC 4.

I have a global class called SomeObject in which I have a deleteUser function. This function is binded with one of the click event of a button present in MyView2.

How do I call the following backbone.js different functions present in different views, from this global function/class.

  • call myMethodB of MyView 2
  • call myMethodA of MyView 1
  • call myMethodC of AppView

Please guide me on this. I am still learning backbone.js and might be doing something wrong. Thanks

var SomeObject = function (Id, Name) {
    var self = this;
    this.Id = Id;
    this.Name = Name;
    this.deleteUser = function () {
        console.log(self.Id, self.Name);

        // call myMethodB of MyView 2
        // call myMethodA of MyView 1
        // call myMethodC of AppView
    };
};

var MyModel = Backbone.Model.extends({
});

// View for a Main Grid
var MyView1 = Backbone.View.extend({
...
myMethodA: function(){
 // do something with View 1
}
...
});


// View for subgrid in Main Grid
var MyView2 = Backbone.View.extend({
...
myMethodB: function(){
 // do something with View 2
}   
...
});

var AppView = Backbone.View.extend({
...
myMethodC: function(){
 // do something with App View 
}
...
});
  • 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-12T08:34:28+00:00Added an answer on June 12, 2026 at 8:34 am

    You should use Backbone events – http://backbonejs.org/#Events

    var SomeObject = function (Id, Name) {
        var self = this;
        this.Id = Id;
        this.Name = Name;
        this.deleteUser = function () {
            console.log(self.Id, self.Name);
    
            viewInstances.MyView2.trigger('eventFormyMethodB')
            viewInstances.MyView1.trigger('eventFormyMethodA')
            viewInstances.AppView.trigger('eventFormyMethodC')
        };
    };
    
    var viewInstances = {
        MyView2: new MyView2({...}),
        MyView1: new MyView1({...}),
        AppView: new AppView({...})
    }
    

    For example

    var AppView = Backbone.View.extend({
    ...
        events: {
            'eventFormyMethodC': 'myMethodC'
        },
        myMethodC: function(){
        // do something with App View 
        }
    ...
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Ajax cross domain call I have Asp.Net Controller methods which return JSON
Possible Duplicate: Can you overload controller methods in ASP.Net MVC? I need to 2
Possible Duplicate: CakePHP: Call to a member function find() on a non-object I have
Possible Duplicate: how to make phone call by using objective c? I am trying
Possible Duplicate: «F(5)» and «int x; F(x)» to call different functions? Can we overload
Possible Duplicate: Does std::list::remove method call destructor of each removed element? I have a
Possible Duplicate: Entity Framework with NOLOCK I'm using EF4 and .Net 4 to load
Possible Duplicate: “Undefined reference to” template class constructor I've just started using templates, and
Possible Duplicate: How to turn a string into a method call? Using Ruby 1.9,
Possible Duplicate: Special (magic) methods in Python who can tell me what can call

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.