Skip to content

Instantly share code, notes, and snippets.

@ElectricMaxxx
Last active December 16, 2015 13:29
Show Gist options
  • Select an option

  • Save ElectricMaxxx/5442006 to your computer and use it in GitHub Desktop.

Select an option

Save ElectricMaxxx/5442006 to your computer and use it in GitHub Desktop.
problem with this.$el in backbone.js
#in the container
layout = Backbone.View.extend({
el:"body"
initialize: ->
this.template = template.layout
this.navigation = new navigation()
this.render()
render:->
opt=
container: config.option.container
res = Mustache.compile this.template
this.$el.empty()
this.$el.append res opt
this.navigation.render()
this
});
#in the navigation:
navigation = Backbone.View.extend({
el:"#navigation"
initialize:->
this.template = template.navigation
render:->
###
opt=
option: config.option
content:
label:
menue: interpreter.get "menue"
views: interpreter.get "views"
uploadFiles: interpreter.get "uploadFiles"
preview: interpreter.get "preview"
details: interpreter.get "details"
dirView: interpreter.get "dirView"
process: interpreter.get "process"
res = Mustache.compile this.template
###
this.$el.empty()
this.$el.append "<h1>Testing<h1>"
#$("#navigation").append "<h1>Testing<h1>"
this
})
#the template:
<div id="{{container}}" class="wrapper">
<div id="navigation"></div>
<div id="browser"></div>
<div id="filter"></div>
</div>
@ElectricMaxxx
Copy link
Author

After both i only see the Container as in the template but no content inside of the div#navigation

@ElectricMaxxx
Copy link
Author

its solved, i can`t instantiate the views of the inner parts before the outer ones are rendered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment