1
我在WinJS中有單頁面應用程序。在default.html(這是默認頁面)我有div我從同一目錄呈現其他頁面。在列表視圖呈現時捕獲事件WinJS
<div id="pagebody"><!--Here is page rendered--> </div>
現在,在該頁面(它被呈現到該div)我有ListView。在ListView模板,每個ListViewItem的我有輸入控制 - 複選框
<input name="ListViewCheckBox" type="checkbox"/> <!--in js I fetch all inputs with name ListViewCheckBox-->
現在,我必須抓住事件時,所有的輸入都被渲染到能夠做某事與他們根據「應用程序狀態」。在default.js文件I調用函數WinJS.UI.Pages.render()
和WinJS.UI.processAll()
WinJS.UI.processAll().done(function() {
//if I try to fetch all inputs here, I get list with 0 elements (as expected)
});
WinJS.UI.Pages.render("OtherPage.html", PageBody).done(function() {
//if I try to fetch all inputs here, I get list with precisely one item
//it catches input declared in template
//the problem is that I need input from each listviewitem
//(if there are for example 20 listviewitems, and I need to fetch all 20 inputs)
});
我取輸入,下面的代碼行:
var Inputs = document.getElementsByName("ListViewCheckBox");
我如何能實現趕上該事件時,每個輸入被渲染,所以我獲取所有這些。
是這甚至可能傢伙? –