1
我需要动态地在jQMobi的导航栏中添加按钮,在异步调用后检索数据。我正在使用append方法,但它在附加完成后不自动刷新页脚。如果我回到上一页并再次返回到带有导航栏的页面,则显示新的按钮。我如何从js刷新?jqmobi动态添加项目到页脚?
我的功能:
function createNavBar(categories) {
// remove any previous items, except for home
var elements = $('#event-footer').children().not('#navbar-home');
$(elements).remove(elements);
// add new items
for(var i=0;i<categories.length;i++)
{
$('#event-footer').append('<a href="#event-home" class="icon home" data-transition="none">'+categories[i].get("Name")+'</a>');
}
}
发现了它。需要将调用添加到$ .ui.updateNavbarElements。 –