クリック イベントを使用して音楽ディレクトリをナビゲートしようとしています。最初は元のリストビューが正常に表示されます。クリック イベントは次のディレクトリにドリルダウンしますが、3 回目のクリックでインデックス位置が返され続けます。元のディレクトリ エントリ オブジェクトのフルパス。
JS
function readerSuccess(entries) {
$("#test").empty();
for (i=0;i<entries.length;i++){
$("#test").append("<li>"+entries[i].name+"</li>");
}
$("#test").listview("refresh");
ListClickHandler(entries);
}
var ListClickHandler = function(something){
$(document).on("click","#test li",function(event){
var mylistname = $(this).text();
var index = $("#test li").index(this);
var listpath = something[index].fullPath; //this is causing the problem. entries never changes.
alert(index);
if(something[index].isFile ===true)
{
$("#test").empty();
alert("this is a file");
}
else if(something[index].isDirectory===true)
{
var directoryentry = new DirectoryEntry(mylistname,listpath);
var directoryreader = directoryentry.createReader();
directoryreader.readEntries(readerSuccess,fail);
//alert("this is a directory"+mylistname+listpath);
}
});
}