0

当用户在执行 AJAX 获取时单击可折叠部分时,我试图显示加载消息。我正在使用 SPServices 库来执行获取。基本上加载消息不显示。一旦 SPServices 操作和单击事件结束,它将显示。我是否正确定义了这个点击事件?谢谢。

$(document).bind('pageinit', function (event) {
    $('.ui-collapsible').click(function (event, data) {
        $.mobile.showPageLoadingMsg();
        var myQueryOptions = "";
        var myQuery = "";
        if ($(this).attr('id') == "NewsContainer" && $("#NewsList li").size() == 0) {
            var myQueryOptions = "<QueryOptions><ViewAttributes Scope='RecursiveAll' IncludeRootFolder='True' /></QueryOptions>";
            var myQuery = "<Query><Where><BeginsWith><FieldRef Name='ContentTypeId' /><Value Type='ContentTypeId'>0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900DD0126D65DE8404CB540571DFA751B850301</Value></BeginsWith></Where></Query>";
        }
        if (myQueryOptions != "" && myQuery != "") {
            $().SPServices({
                operation: "GetListItems",
                async: false,
                listName: "Pages",
                CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='PublishingPageContent' /><FieldRef Name='NewsDate' /></ViewFields>",
                CAMLQuery: myQuery,
                CAMLRowLimit: 5,
                CAMLQueryOptions: myQueryOptions,
                completefunc: function (xData, Status) {
                    $(xData.responseXML).SPFilterNode("z:row").each(function () {
                        ....
                    });
                }
            });
        }
    });
});
4

1 回答 1

0

将 JSshowLoading放在超时处理程序之后应该会给您预期的结果。

请参阅这个问题:在 jQuery Mobile 1.1 中进行繁重处理之前显示加载微调器?

于 2012-08-07T06:50:02.620 回答