我正在使用带有 SPServices 的 jQuery Mobile 将 SharePoint 数据拉入移动页面。所有数据都实际加载,但我没有成功让微调器在提取数据时加载。
我已经阅读了几页您必须设置async: true
才能使其正常工作的页面,但这没有帮助。我还尝试了几种方法来显示和隐藏都不起作用的微调器。
- jQuery 1.7.2
- jQuery 移动 1.1.0
- SPServices 0.7.1a http://spservices.codeplex.com/
有任何想法吗?
不工作
$(document).delegate('#top-stories', 'pageshow', function () {
function getList(){
// ....
} // end function
$.mobile.showPageLoadingMsg();
getList();
$.mobile.hidePageLoadingMsg();
});
不工作
$(document).delegate('#top-stories', 'pageshow', function () {
function getList(){
$.mobile.showPageLoadingMsg();
$().SPServices({
// ....
});
$.mobile.hidePageLoadingMsg();
} // end function
getList();
});
加载项目和工作的代码,只是没有微调器
$(document).delegate('#top-stories', 'pageshow', function () {
function getList(){
$().SPServices({
operation: "GetListItems",
listName: "Posts",
webURL: "/SiteDirectory/news_and_updates",
async: true,
CAMLRowLimit: 15,
CAMLQuery: "<Query><OrderBy><FieldRef Name='Created' Ascending='FALSE' /></OrderBy><Where><Eq><FieldRef Name='PostCategory' /><Value Type='Choice'>Announcements</Value></Eq></Where></Query>",
CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='ID' /></ViewFields>",
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
var liHtml = "<li data-theme=\"c\"><a href=\"javascript:viewStory(" + $(this).attr("ows_ID") + ")\">" + $(this).attr("ows_Title") + "</a></li>";
$("#top-stories ul").append(liHtml).listview("refresh");
});
}
});
} // end function
getList();
});