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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:18:04+00:00 2026-05-27T17:18:04+00:00

Inside Backbone.View instances one can set an events hash of callbacks: events: { ‘click

  • 0

Inside Backbone.View instances one can set an events hash of callbacks:

events: { 'click #element' : 'myFunction' }

When the function I try to access is not a direct function of the view instance (e.g. this.model.myFunction) I cannot pass the function right in the events hash. I have tried:

events: { 'click #element' : 'model.myFunction' }

and

events: { 'click #element' : this.model.myFunction }

How can I tell my backbone view to use this.model.myFunction as a callback right from the events hash?

  • 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-05-27T17:18:05+00:00Added an answer on May 27, 2026 at 5:18 pm

    No, you can’t do that. The relevant chunk of Backbone looks like this:

    delegateEvents : function(events) {
      if (!(events || (events = getValue(this, 'events')))) return;
      this.undelegateEvents();
      for (var key in events) {
        var method = this[events[key]];
        if (!method) throw new Error('Event "' + events[key] + '" does not exist');
        //...
    

    So the values in events have to be the names of methods in your view object. You could route the events yourself though:

    events: { 'click #element': 'myFunction' },
    // ...
    myFunction: function(e) {
        this.model.myFunction(e);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to bind events on body element inside a view? For example
I have a backbone view with a model inside it. When I call the
This is my View in Backbone framework: jQuery(document)ready(function() { com.company.View = Backbone.View.extend({ initialize :
Inside a knockout.js binding expression, I can use the $data , $parent , and
I have a relatively simple Backbone handled message container. I can add messages, and
I'm using default drag and drop inside a backbone application i'm listening event in
I'm trying to get my backbone associations working inside a rails app , and
Inside my TableView, I am pressing one of the cells to enter the detailed
Inside a function I have created, I have this loop that checks if the
I have a view I am able to load. However the events do not

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.