Created
January 15, 2014 21:38
-
-
Save sohan/8445209 to your computer and use it in GitHub Desktop.
Correct way of adding child views to a specific dom element in the parent's collection view in Chaplin.js. Uses the option listSelector instead of container. Reference: http://sohanjain.com/2014/01/chaplin-jss-container-containermethod-and-listselector-options/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'views/base/view', | |
'jquery', | |
'text!templates/player-song.hbs', | |
], function(View, $, template) { | |
'use strict'; | |
var PlayerSongView = View.extend({ | |
autoRender: true, | |
autoAttach: true, | |
template: template, | |
className: 'song-container', | |
... | |
}); | |
return PlayerSongView; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define([ | |
'views/base/collection-view', | |
'jquery', | |
'text!templates/player-songs.hbs', | |
], function(CollectionView, $, template) { | |
'use strict'; | |
var PlayerSongsView = CollectionView.extend({ | |
template: template, | |
className: 'song-container', | |
listSelector: '.player-songs' | |
... | |
}); | |
return PlayerSongsView; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment