I'm using backbone jquery mobile and coffee script to develop a simple twitter application. My problem is the jquery mobile styles are failing to render. My View is
class HomeView extends Backbone.View
constructor: ->
super
initialize: ->
@Twitter= new TwitterCollection
template: _.template($('#home').html())
render: ->
@loadResults()
loadResults: ->
@Twitter.fetch({
success: (data) =>
$(@.el).html(@template({data: data.models, _:_}))
error: ->
alert('Error!')
})
This works fine in terms of pulling information from Twitter, however when
$(@.el).html(@template({data: data.models, _:_}))
is within the fetch function, jquerys styles do not render. Can anyone show me how to refresh the styles? Help would be much appreciated!
For reference, the html template is:
<script type="text/template" id="home">
<div data-role="header" data-position="fixed">
<h1>TWITTER DATA</h1>
</div>
<div data-role="content">
<ul data-role="listview" data-inset="true">
<% _.each(data, function (row) { %>
<li><a href="#tweet-<%= row.get('id') %>"><%= row.get('text') %></a></li>
<% }); %>
</ul>
</ul>
</div>