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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:50:09+00:00 2026-06-18T00:50:09+00:00

Here is my view: define([ ‘jquery’, ‘underscore’, ‘backbone’, ‘models/tableModel’, ‘collections/tablesCollection’, ‘views/tablesView’ ], function($, _,

  • 0

Here is my view:

define([
    'jquery',
    'underscore',
    'backbone',
    'models/tableModel',
    'collections/tablesCollection',
    'views/tablesView'
], function($, _, Backbone, tableModel, tablesCollection, tablesView) {
    require(['collections/tablesCollection'], function(tablesCollection) {
        var t = new tablesCollection(null, {url: 'main-contact'});
        var tables = new tablesView({ collection: t, template: 'main-contact-template'});
        tables.url = 'main-contact';
        return tables;  // <!-- returns view, tables can be console.log'ed
    });

    console.log(tables); // <!-- tables is not defined
});

How do I get the tables within the require statement so that is accessible where the console.log is? This seems to be where I need to return the view from, so I can use it in my route:

app_router.on('route:index', function(){
        require(['views/tables/mainContactView'], function(mainContactView) {
            console.log(mainContactView);  // <!-- undefined, unless some value is returned from where the console.log() is above
            $('#web-leads').html(mainContactView.render().el);
        });
    });

If I put return 'test' where the console.log(tables) is, I can console.log() it in my route. So I assume that’s where I need to return the view from. How do I pass that data out? Right now, even with a return statement, my view is undefined. I need to get the view out of the require. How do I do that?

  • 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-18T00:50:11+00:00Added an answer on June 18, 2026 at 12:50 am

    You’ve already loaded collection/tablesCollection in define, so you don’t have to do another require to get it loaded.

    You can simply the definition of the View as this:

    define([
        'jquery',
        'underscore',
        'backbone',
        'models/tableModel',
        'collections/tablesCollection',   // You've already required tablesCollection here.
        'views/tablesView'
    ], function($, _, Backbone, tableModel, tablesCollection, tablesView) {
        var t = new tablesCollection(null, {url: 'main-contact'});
        var tables = new tablesView({ collection: t, template: 'main-contact-template'});
        tables.url = 'main-contact';
        return tables;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Short question - how do you define your view models? Here are some of
Here is my MainView: Ext.define(Test.view.Main, { extend: 'Ext.Panel', config: { cls: 'transp' } });
I have a problem displaying my Ext.list component. Here is my code: Ext.define(iphone.view.customers.List, {
I have two backbone Views. One is the main view and the other is
This question already has an answer here: view sql that linq-to-sql produces 3 Answers
By 'view' here I mean different combinations of properties of the model, not the
I have a layout setup which can be view here: http://jsfiddle.net/Pn3ts/ It all works
i wanna do a single selection in my table view here is my code
I am Developing an application which consists of video-view,Here is my problem when I
Here's the view: @if (stream.StreamSourceId == 1) { <img class=source src=@Url.Content(~/Public/assets/images/own3dlogo.png) alt= /> }

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.