Vote count:
0
I am working on a django powered SPA app that's primary interface is powered by jquery mobile.
I have a single panel. My end goal is to have this panel dynamically updated depending on the link the user clicks to open it.
The panel starts blank:
<div data-role="panel" id="properties_panel" data-display="overlay" data-position="right" data-position-fixed=true>
</div>
However, when certain links are clicked, I would like to load external html files using AJAX to update the content of the panel:
var panel_text;
var menu_item_selector = $.get( "{% static 'elements/menu_preferences_elements.html' %}", function() {
panel_text = menu_item_selector['responseText'];
})
.done(function() {
})
.fail(function() {
})
.always(function() {
});
Now, the ajax file is successfully fetched and loaded, however, my goal is to display the content as a jquery mobile element (in this case a list view). However, the content is displaying as a normal list, not as a listview.
Contents of menu_preferences_elements.html: Search for menu item Use the search box below to search for a menu item.
<script>
menu_database().each(function(record){
document.write("<li><a href='#' data-elementid='"+record.Item_Id+"'>"+record.Name+"</a></li>");
});
</script>
</ul>
</div>
</div>
If I put the contents of that external html file directly into the panel, it functions 100% as expected. However, when I dynamically add it, it doesn't treat it as jquery mobile content, and instead renders it as a plain list.
Here is the jquery onclick listener:
$(".editing_tools_section").on('click','.editing_tools_item', function(){
$("#properties_panel").html(panel_text);
$("#properties_panel").trigger('updatelayout');
$("#properties_panel").panel("open");
});
Is there a way to make the content display correctly as a filterable jquery mobile listview?
Aucun commentaire:
Enregistrer un commentaire