我创建了一个带有网格块的页面,其中包含使用“jquery-mobile”插件的按钮。网格内的按钮是在运行时动态创建的。在回拨电话后,旧值仍然存在。我想在更新后用新值刷新网格。
这是代码。
html:
<div id="chapter_div" data-role="page" data-content-theme="a">
<div data-role="header">
<h1>Chapter Chooser</h1>
</div>
<div data-role="content" class="ui-grid-d" id="show_chapter_number">
</div>
</div>
Javascript/Jquery 代码:
function showChapter(book_id) {
var chapter_count=" ";
var menu = " ";
var html = " ";
var row_count = 1;
var row_block_id = 'a';
chapter_count = getChapterCount(book_id);
for (itr = 1; itr <= chapter_count; itr++) {
switch(row_count) {
case 1:
row_block_id = 'a';
row_count++;
break;
case 2:
row_block_id = 'b';
row_count++;
break;
case 3:
row_block_id = 'c';
row_count++;
break;
case 4:
row_block_id = 'd';
row_count++;
break;
case 5:
row_block_id = 'e';
row_count=1;
break;
}
html += "<div class=\"ui-block-"+row_block_id+"\"><button onclick=\"javascript:showVerse(" + book_id + ",\'" + itr + "\');\" class=\"ui-bar ui-bar-c\" style=\"width:70px\">" + itr + "</button></div>";
}
var grid_chapter = $('#show_chapter_number');
grid_chapter.append(html);
$.mobile.changePage("#chapter_div", {transition: 'pop', role: 'dialog'});
**grid_chapter.content("refresh");**
}
回发后,我应该如何刷新网格或内容中的项目?
我应该如何更改这行代码:grid_chapter.content("refresh");
使其正常工作?
谢谢。