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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:40:32+00:00 2026-05-28T15:40:32+00:00

I have two backbone Views. One is the main view and the other is

  • 0

I have two backbone Views. One is the main view and the other is a view that will be used within the main view. I am making individual modules for my various views. I have the main view being loaded and run fine from the router. Here are my two views:

MAIN VIEW:

 define([
    'jquery',
    'backbone',
    'metros/docsMetro'
], 
function($, Backbone, docsMetro) {
    //Main Dashboard View
    var Dashboard = Backbone.View.extend({
            el: $('#mainContent'),
            events: {

            },


            initialize: function() {
                console.log('test');
                //Validate User Here most likely.  Each of the main view's for each app should probably call the same validation function


            },

            render: function (){
                console.log('testing render');

            }

        });


    // Return the Main Dashboard View
    return new Dashboard;

The ‘metros/docsMetro’ file that is being loaded with require there in the top. I can see that this view is loading and is running through the init.

define([
    'jquery',
    'backbone'
], 
function($, Backbone) {
    //Docs Metro View
    var docsMetro = Backbone.View.extend({
            el: $('.docs'),
            events: {},

            initialize: function() {
                console.log('docs Metro');

            },

            render: function (){
                console.log('redering docs');

            }

        });

    // Return the View
    return new docsMetro;
});

My issue is in the Main View the ‘docsMetro’ variable that should be the returned docsMetro view is coming back null.

What am I missing, seems like it is all setup correctly?

  • 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-28T15:40:33+00:00Added an answer on May 28, 2026 at 3:40 pm

    can you try setting paths to modules to be relative?

    instead of doing 'metros/docsMetro' do './metros/docsMetro' (assuming metros folder is on the same level as the module file from which you require metros/docsMetro)

    And few other tips and fixes for your code.

    Modules should return constructors rather then instances and you should instantiate them in the initializers for views that are requiring them.

    jQuery and Backbone aren’t going to drop support for global registering of their namespace so you don’t need to pass them every time to the dependencies array. It’s enough if you require them once in the boostrap before you load your router and main view which will take care of loading the rest of the app

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

Sidebar

Related Questions

I have two views, one represents a view of clients and the other is
I have the follow backbone view: core.views.Login = Backbone.View.extend( { el: '#main-content-wrapper', events: {
I have two applications written in Java that communicate with each other using XML
I have two backbone models, loaded from server: var Model = Backbone.Model.extend({}); var SubModel
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two classes, and want to include a static instance of one class
I have two threads, one needs to poll a bunch of separate static resources
In the code below I have two jQuery selectors that seem to work correctly.
I have noticed that when multiple attributes of a Backbone model are set like
I have two tables inside a database. One stores unique userNames and a unique

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.