我正在尝试使用单击事件浏览我的音乐目录 - 我可以让原始列表视图显示正常,单击事件将向下钻取到下一个目录,但在第三次单击时,我的索引位置不断返回原始目录条目对象的完整路径。
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);
            }
    });
}