momohy
momohy
  • 发布:2017-04-11 17:31
  • 更新:2017-04-12 11:56
  • 阅读:1293

求助:选项卡+上拉加载刷新中,为什么出现了结束上拉信息之后才出来数据。

分类:MUI

应该是加载完才出来结束上拉信息啊
代码:::::

    (function($) {  
                //阻尼系数  
                var deceleration = mui.os.ios ? 0.003 : 0.0009;  
                $('.mui-scroll-wrapper').scroll({  
                    bounce: false,  
                    indicators: true, //是否显示滚动条  
                    deceleration: deceleration  
                });  
                $.ready(function() {  

                    //循环初始化所有下拉刷新,上拉加载。  
                    $.each(document.querySelectorAll('.mui-slider-group .mui-scroll'), function(index, pullRefreshEl) {  
                        $(pullRefreshEl).pullToRefresh({  
                            down: {  
                                callback: function() {  
                                    var self = this;  
                                    setTimeout(function() {  
                                        var ul = self.element.querySelector('.mui-table-view');  
                                        //ul.insertBefore(createFragment(ul, index, 10, true), ul.firstChild);  
                                        self.endPullDownToRefresh();  
                                    }, 500);  
                                }  
                            },  
                            up: {  
                                auto: true, //可选,默认false.自动上拉加载一次  
                                show: true, //显示底部上拉加载提示信息,可选;  
                                contentinit: '可以1', //可以上拉提示信息  
                                contentdown: '-', //上拉结束提示信息  
                                contentrefresh: '正在加载...', //上拉进行中提示信息  
                                contentnomore: '没有更多数据了4', //上拉无更多信息时提示信息                                             
                                callback: function() {  
                                    var self = this;  

                                    setTimeout(function() {  
                                        var ul = self.element.querySelector('.mui-table-view');                                       
                                        pageIndex++;  
                                        //ul.appendChild(createFragment(ul, index,''));  
                                        createFragment(ul, index);                                        
                                        self.endPullUpToRefresh(pagetotalcount = Dbtotalcount);  
                                    }, 500);  
                                }  
                            }  
                        });  
                    });  

                });  
            })(mui);  

            function createFragment(ul, index) {  
                //var ul = document.createDocumentFragment();  
                var li;  
                var url = UDenwebCustomrOrderServiceUrl + '/GetOrderPayList';  

                mui.ajax(url, {  
                    data: {  
                        customerId: customerId,  
                        PayType: payTypeText,  
                        StartDate: StartDateText,  
                        endDate: EndDateText,  
                        type: 0,  
                        dbkey: dbkey,  
                        Pagesize: 10,  
                        pageIndex: pageIndex  
                    },  
                    dataType: 'jsonp', //返回数据类型  
                    type: 'get', //HTTP请求类型   
                    success: function(data) {  
                        var payinfoList = JSON.parse(data);  

                        mui.each(payinfoList, function(i, item) { //状态  
                            if(i == index) {  
                                mui.each(item, function(i, item1) { //单个记录  
                                    var PaymentNo = item1.PaymentNo;  
                                    var ProceeState = item1.ProceeState;  
                                    var CreateTime = item1.CreateTime.substring(0, 10);  
                                    var PropaymentType = item1.PropaymentType;  
                                    var ProceedsInfoStr = item1.ProceedsInfoStr;  
                                    var Money = item1.Money;  
                                    var id = item1.IdStr;  
                                    ++pagetotalcount;  
                                    Dbtotalcount = item1.RecordCount;  
                                    if(item1.ProceeState == null) ProceeState = '';  
                                    if(item1.PropaymentType == null) PropaymentType = '';  
                                    if(item1.ProceedsInfoStr == null) ProceedsInfoStr = '';  

                                    li = document.createElement('li');  
                                    li.id = id;  
                                    li.className = 'box-white-top around-layout-p';  
                                    li.innerHTML = '<a href="user_pay_details.html"><p>' +  
                                        '<span class="mui-pull-left">流水号:' + PaymentNo + '</span>' +  
                                        '<span class="mui-pull-right">' + ProceeState + '</span>' +  
                                        '</p>' +  
                                        '<p class="b-bottom-1px underline">' +  
                                        '<span class="mui-pull-left">' + CreateTime + '</span>' +  
                                        '</p>' +  
                                        '<p>' +  
                                        '<span class="mui-pull-left">' + ProceedsInfoStr + '</span>' +  
                                        '<span class="mui-pull-right">¥' + Money + '</span>' +  
                                        '</p>' +  
                                        '<p>' +  
                                        '<span class="mui-pull-left gray-font">' + PropaymentType + '</span>' +  
                                        '</p></a>';  
                                    ul.appendChild(li);  
                                    //console.log(pagetotalcount+'======'+Dbtotalcount)  
                                });  
                            }  

                        });  
                    },  
                    error: function(xhr, type, errorThrown) {  
                        console.log(type);  
                    }  
                });  
                return ul;  
            };
2017-04-11 17:31 负责人:无 分享
已邀请:
z***@163.com

z***@163.com

ajax改同步试试?

  • momohy (作者)

    好的 谢谢哦

    2017-04-14 15:45

该问题目前已经被锁定, 无法添加新回复