【问题标题】:How to add events to move to other page for a dynamically created listview in jquery mobile?如何在 jquery mobile 中为动态创建的列表视图添加事件以移动到其他页面?
【发布时间】:2011-08-27 01:05:11
【问题描述】:

使用下面的代码,我在列表视图中插入了数据

var renderItemElement = function(item) {

    return $.tmpl("<li><a>${text}</a></li>", item)
        .data("item", item)
        .insertAfter(listHeaders[item.priority]);   
};

单击它时,我可以删除数据,但是当我单击它时,我希望将数据传递到下一页。谁能帮我处理这段代码?

$("#bankList").delegate("li.item", "click", function() {
   model.remove($(this).data("item"));
    $(this).slideUp(function() {
       $(this).remove();
    });
});

【问题讨论】:

    标签: json html listview jquery-mobile jquery-templates


    【解决方案1】:

    如果你有一个 href 或者你想要整个东西显示为一个列表视图,你需要使用.listview() 方法。如果ul标签已经存在并且是listview,使用.listview('refresh')

    要使用javascript而不是href移动到另一个页面,您需要使用

    $.mobile.changePage()

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多