Note that there are some explanatory texts on larger screens.

plurals
  1. POBackbone layoutmanager nested views error
    primarykey
    data
    text
    <p>I'm getting a strange error when attempting to use nested views in a Backbone layouamanager. Here is the nested view (I'm also using RequireJS):</p> <pre><code>define([ 'jquery', 'underscore', 'backbone', 'templates', ], function ($, _, Backbone, JST) { 'use strict'; var ResultsView = Backbone.View.extend({ template: JST['app/scripts/templates/results.ejs'], }); return ResultsView; }); </code></pre> <p>And here is the parent layout view:</p> <pre><code>define([ 'jquery', 'underscore', 'backbone', 'templates', 'layoutmanager', 'views/results-view' ], function ($, _, Backbone, JST, manager, ResultsView) { 'use strict'; Backbone.Layout.configure({ manage: true }); var AppView = Backbone.Layout.extend({ template: JST['app/scripts/templates/App.ejs'], el: '#container', views: { "#search-results": new ResultsView() } }); return AppView; }); </code></pre> <p>And here is the code that instantiates the parent layout:</p> <pre><code>define([ 'jquery', 'underscore', 'backbone', 'views/App-view' ], function($, _, Backbone, AppView){ var initialize = function(){ new AppView().render(); }; return { initialize: initialize }; }); </code></pre> <p>When I load the page I get the following error:</p> <pre><code>"Uncaught TypeError: Cannot read property 'ownerDocument' of undefined" </code></pre> <p>The error comes from Jquery. If I remove this line from the above code:</p> <pre><code>el: '#container', </code></pre> <p>The error goes away. I'm still new to Backbone, so maybe I'm using the view incorrectly? Thanks for any help</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload