我正在使用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调用,任何想法?