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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:39:53+00:00 2026-05-26T16:39:53+00:00

I have the following class that extends Backbone.View, I want all my backbone views

  • 0

I have the following class that extends Backbone.View, I want all my backbone views to inherit from this class:

class BaseView
  constructor: (options) ->
    @bindings = []
    Backbone.View.apply(@, [options])

  _.extend(BaseView.prototype, Backbone.View.prototype, {
  #etc. tec.

BaseView.extend = Backbone.View.extend

I can then extend my own view like this:

class BusinessUnitsView extends BaseView
  initialize: (options) ->

This all works fine if they are in the same file but if I separate BaseView into a different file, I get an error message:

BaseView is undefined

How can I keep the BaseView in a different file and use it to extend my custom views?

  • 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-26T16:39:54+00:00Added an answer on May 26, 2026 at 4:39 pm

    Put this under BaseView.extend = Backbone.View.extend

    @.BaseView = BaseView
    

    it makes your BaseView global accessible

    I always declare my classes like this and it works great

    class BaseView extends Backbone.View
    
    @.BaseView = BaseView
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that extends View and overrides the onDraw(Canvas canvas) method. This
Lets say that I have the following code: public class Shelter<A extends Animal, B
I have several queues that all extend a Queue class. I want to do
I am using underscore.js's templating capabilities from backbone.js, I have the following template that
New to python... I have the following class Key, that extends dict: class Key(
I have the following class that extends AdvancedDataGridItemRenderer: package { import mx.controls.advancedDataGridClasses.AdvancedDataGridItemRenderer; public class
I have code that looks like the following in a class that extends MembershipProvider
I have a Player class that extends CCNode, and i want to hava a
I have the following situation. I have a Java Class that inherits from another
I have the following problem: I have a class A that extends s:Panel. I

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.