jquerymobile知识点五:动态Grid的绑定以及刷新

来源:互联网 发布:湖南自兴人工智能 编辑:程序博客网 时间:2024/06/05 17:54

       下面jquerymobile是ajax动态绑定和刷新的例子。直接上图以及代码。

      

      下面是实例代码:

       

    

//初始绑定    function GetInitBind(PageIndex, PageSize, sqlwhere, OrderType) {        showLoading();        var adapGrid = $("#adapGrid");        $.ajax({            type: "POST",            url: "/Ashx/YouHui.ashx?MethodName=GetSealsList&PageSize=" + PageSize + "&PageIndex=" + PageIndex + "&date=" + new Date().getTime() + "&SqlWhere=" + sqlwhere + "&OrderType=" + OrderType,            data: "",            dataType: "json",            success: function (data) {                data = eval(data);                var strleft = "";                $.each(data.List, function (i, item) {//打折商品列表                    if (i % 2 == 0) {                        strleft += "<div class='ui-block-a' style='height:100%'>";                        strleft += "<img style='width:99%;' src='" + item.YouhuiFilepath + "'/>";                        strleft += "<a class='descriptions'>";                        strleft += "<p>剩余时间:" + unescape(item.Day) + "</p>";                        strleft += "</a>";                        strleft += "</div>";                    } else {                        strleft += "<div class='ui-block-b' style='height:100%'>";                        strleft += "<img style='width:99%;' src='" + item.YouhuiFilepath + "'/>";                        strleft += "<a class='descriptions'>";                        strleft += "<p>剩余时间:" + unescape(item.Day) + "</p>";                        strleft += "</a>";                        strleft += "</div>";                    }                });                adapGrid.append(strleft).trigger("create");//重要(刷新)            },            error: function (data) {               // $("#goodlist").html("数据有误!");            }        });        hideLoading();    }

希望对初学者有所帮助。。。。

     

      








原创粉丝点击