Имам оформление
<div id="region">
<h1>Header</h1>
<ul class="items">
<li>Number = 1</li>
<li>Number = 2</li>
<li>Number = 3</li>
</ul>
</div>
Това изобразяване от бекенда Как да вземете данни от маркирането и да изобразите само нов ItemView и да премахнете тези, които не са в json файла
class Collections extends Backbone.Collection
initialize: ->
console.log 'Collections init'
class NowListning extends Marionette.CompositeView
template : _.template("<h1>Header</h1> <ul class='items'></ul>")
itemView: NowListningItem
itemViewContainer: '.items'
initialize : ->
console.log 'init:: View: Local -> NowListning'
class NowListningItem extends Marionette.ItemView
template : _.template("<%= text %>")
tagName: "li"
domData = []
$('items li').each ->
item:
text: $(this).text()
domData.push(item)
collections = new Collections(domData)
nowListning = new NowListning
collections.fetch
url: 'items.json'
Ако създам регион и извикам метода Show, той променя CompositeView, но искам да актуализирам само списъка, без заглавие
json
[
{
"text": "Number = 3"
},
{
"text": "Number = 4"
}
]
И искам да видя
<div id="region">
<h1>Header</h1>
<ul class="items">
<li>Number = 3</li>
<li>Number = 4</li>
</ul>
</div>