0

我正在使用 jquery Mobile 1.0,我需要显示一个订单列表。它将默认显示所有记录并在下拉选择中过滤记录。

这是我尝试过的

function show_List(urlObj, options) {
    var sortValue = 0;
    var headerTextList;
    $("#dList").bind("change", function (event, ui) {
        sortValue = $(this).val();
        if (sortValue == 1) {
            headerTextList = "<B><font color=navy>Completed Work Orders </font></B>";
        }
        else if (sortValue == 2) {
            headerTextList = "<B><font color=navy>In Process Work Orders </font></B>";
        }
        else if (sortValue == 3) {
            headerTextList = "<B><font color=navy>Pending Work Orders </font></B>";
        }
        else if (sortValue == 0) {
            headerTextList = "<B><font color=navy>All Work Orders </font></B>";
        }

        getListView(sortValue, urlObj, options, headerTextList);
       // ajax call based on sortvalue

    });
    getListView(sortValue, urlObj, options, headerTextList);// ajax call
    // ajax call based on sortvalue
} 

上面的方法调用

$(document).bind("pagebeforechange", function (e, data) {
if (typeof data.toPage === "string") {

    var u = $.mobile.path.parseUrl(data.toPage);
    var qrcode = /^#Orderlist/;
    if (u.hash.search(qrcode) !== -1) {
        show_List(u, data.options);
        e.preventDefault();
    }
  )};

它工作正常,但它调用该方法getListView两次,我只想要一个 ajax 调用,知道吗?

4

0 回答 0