Work notes-front page paging data echo

Source: Internet
Author: User

Modalfunction Modal (obj) {var = this;        That.ref = "";        That.obj = obj; That.init ();}            Modal.prototype = {init:function () {var. = this; JQuery ('. Modal-head i[role= ' Close-modal "],[role=" Btncancel "],[role=" Btnok "] '). Click (function () {$ (this). PA                Rents ('. Modal '). Removeclass (' modal-in ');                $ (' body '). Removeclass (' Modal-open ');            Console.log (New Date (). GetTime ())});                   JQuery (' [data-toggle= ' modal '] '). Click (function (e) {e.preventdefault ();                   That.ref = JQuery (this). attr (' href ');                   if (that.obj = = that.ref) {that.showmodal ();           }})}, Showmodal:function (callback) {var = this;           JQuery (that.obj). addclass (' modal-in ');           JQuery (' body '). addclass (' Modal-open '); if (callback!== "" && callback!==undefined && jquery.iSfunction (callback)) {callback ();           }}, Closemodal:function (callback) {var = this;           JQuery (that.obj). Removeclass (' modal-in ');           JQuery (' body '). Removeclass (' Modal-open ');           if (callback!== "" && callback!==undefined && jquery.isfunction (callback)) {callback ();  }}}jquery (function () {var pages = null;  var clickedpage = false;  var curpage = null;        var selectedval = []; function RenderData () {var url =contextpath+ "/admin/query_goods.htm", data = arguments[0], status = Arguments[1  ]; Jquery.ajax ({type: "Post", Url:url, Data:data, Async:false, Su                 Ccess:function (data) {data = Json.parse (data); pages = data[1].                 Pages; Curpage = data[1].                 CurrentPage; Console.log (Data[1].                 Pages); if (data) {if (data[0].goods_info.length>0) {                     var html = ';                                     Jquery.each (Data[0].goods_info,function (i,item) {html + = ' <tr id= "' +item.id+ '" > ' + ' <td align= ' center ' ><label class= ' s-checkbox ' ><input type= ' checkbox ' class= ' cus Tom-checkbox "/><span></span></label></td> ' + ' <td align= "Center" > ' +item.id+ ' </td> ' + ' <td align= ' center ' > ' +item.goods_name+ ' <                                     /TD> ' + ' <td align= "center" > ' +item.net_content+ ' </td> ' + ' <td align= ' center > ' +item.store_price+ ' </td> ' </t                                                  R> ';                                      }) JQuery ('. Fshop_table.coupon-list tbody '). HTML (HTML); } else if (data[0].goods_info.length==0) {jQuery ('. Fshop_table.coupon-list tbody '). html (');                  }}//The page is rendered in this manner without clicking the paging button (!status) {                 var pagecontent = '; for (Var i=0;i<data[1]. pages;i++) {if (data[1]. currentpage== (i+1)) {pagecontent + = ' <li class= ' s-page-bage active ' ><span > ' +data[1 ].                         Currentpage+ ' </span></li> '; } else{PageContent + = ' <li class= "s-page-bage" ><span > ' + (i+1) + ' &LT;/SPAN&GT;&L                 T;/li> ';                 }} jQuery ('. S-goodslist-pages ul '). HTML (pagecontent);                         var width = parseint (JQuery ('. S-page-bage span '). Width ()) +15; JQuery ('. S-goodslist-pages ul '). CSS (' width ', width* (data[1).                 Pages));           }                },  Error:function (e) {console.debug (' Error loading commodity data: ' +e}}})} function Renderpages (curp Age) {if ((curPage-2) >0 && (curpage+2) < pages) {pagecontent = ' <li class= ' s-page-bage ' >&  Lt;span > ' + (curPage-2) + ' </span></li> ' + ' <li class= "S-page-bage" ><span  > ' + (curPage-1) + ' </span></li> ' + ' <li class= "s-page-bage Active" ><span > ' + (curpage) + ' </span></li> ' + ' <li class= "s-page-bage" ><span > ' + (c urpage+1) + ' </span></li> ' + ' <li class= "s-page-bage" ><span > ' + (curpage              +2) + ' </span></li> ';          JQuery ('. S-goodslist-pages ul '). HTML (pagecontent); } else if (curpage== (pages-2)) {pagecontent = ' <li class= ' s-page-bage ' ><span > ' + (pages-4) +               ' </span></li> '               + ' <li class= "s-page-bage" ><span > ' + (pages-3) + ' </span></li> '                              + ' <li class= "s-page-bage active" ><span > ' + (pages-2) + ' </span></li> ' + ' <li class= "s-page-bage" ><span > ' + (pages-1) + ' </span></li> ' + ' &lt              Li class= "s-page-bage" ><span > ' + (pages) + ' </span></li> ';          JQuery ('. S-goodslist-pages ul '). HTML (pagecontent); } else if (curpage== (pages-1)) {pagecontent = ' <li class= ' s-page-bage ' ><span > ' + (pages-4) + ' &lt              ;/span></li> ' + ' <li class= "s-page-bage" ><span > ' + (pages-3) + ' </span></li> ' + ' <li class= "s-page-bage" ><span > ' + (pages-2) + ' </span></li> ' + ' <li class = "S-page-bage Active" ><span > ' + (pages-1) + ' </span></li> ' + ' <li class= ' s-page-bage"><span > ' + (pages) + ' </span></li> '; JQuery ('. S-goodslist-pages ul '). HTML (pagecontent); } else if (curpage==2) {pagecontent = ' <li class= ' s-page-bage ' ><span> ' +1+ ' </span></li > ' + ' <li class= "s-page-bage active" ><span > ' +2+ ' </span></li> ' + ' < Li class= "s-page-bage" ><span > ' +3+ ' </span></li> ' + ' <li class= ' s-page-bage ' ><spa n > ' +4+ ' </span></li> ' + ' <li class= "s-page-bage" ><span > ' +5+ ' &LT;/SPAN&GT;&LT;/LI&G t; ';          JQuery ('. S-goodslist-pages ul '). HTML (pagecontent);  }} function LoadData () {renderData ();    } loaddata ();                      Paging jquery ('. S-page-bage '). Live (' click ', function () {var curpage = parseint (jquery (this). Find (' span '). Text ()), Goodsclass = jquery (' #goods_class '). Val (), storeName = jquery (' #store_name '). Val (), Good Sbrand = JQuery (' #goods_brand '). Val (), goodsname = JQuery (' #goods_name '). Val (), pagecontent = null, data = {goods_class:goodsclass,store_name:storename,goods_brand:goodsbrand,goods_name:goodsname,currentpage:                             Curpage};          Clickedpage = true;      Console.log (' +selectedval ') jQuery (this). addclass (' active '). Siblings (). Removeclass (' active ');            RenderData (Data,clickedpage);                    Renderpages (Curpage);              var tr = jQuery ('. Fshop_table.coupon-list tbody tr '); Jquery.each (Selectedval,function (i,item) {Jquery.each (Tr,function (j,info) {if (JQuery (info). attr (              ' id ') {==item) {JQuery (info). Find (' input[type= "checkbox"] '). Prop (' checked ', true);  }})}) JQuery (' #coupon-list tbody tr '). Live (' click ', function () {var Checkedcontent = JQuery (' #coupon-list tbody '). Find (' tr input[type= ' checkbox ']:chEcked '); if (checkedcontent.length>0) {//Insert Data Jquery.each (Checkedcontent,function (i,item) {var id = JQ          Uery (item). Parents (' tr '). attr (' id ');          if (selectedval.length>0 && selectedval.join (', '). IndexOf (ID) >-1) {return true}          else{Selectedval.push (JQuery (item). Parents (' tr '). attr (' id '));          }                                  }); if (!jquery (this). Find (' input[type= "checkbox"] '). Is (': Checked ')) {//Remove cancel option var id = jQuery (th          IS). attr (' id '); if (selectedval.length>0 && selectedval.join (', '). IndexOf (ID) >-1) {var curindex = Jquery.inarray (ID,              Selectedval);          Selectedval.splice (curindex,1); }})//Query JQuery (' #s-search-goods-list '). Live (' click ', function () {var goo Dsclass = jquery (' #goods_class '). Val (), storeName = jquery (' #store_name '). Val (),              Goodsbrand = jquery (' #goods_brand '). Val (), goodsname = jquery (' #goods_name '). Val ( ), data = {Goods_class:goodsclass,store_name:storename,goods_brand:goodsbrand,goods_name:goodsnam                        E,currentpage:curpage};              RenderData (Data,clickedpage);      Renderpages (Curpage);  })//confirm the selected commodity var modalcoupongoods = new Modal (' #showCouponList '); jquery (' #selectGoodsOk '). Click (function () {Modalcoupongoods.closemodal () {jquery (' #    Selectedval '). Val (Selectedval.join (', '));    })    }); jquery ('. Modal-head i[role= ' Close-modal "]). Click (function () {Modalcoupongoods.closemodal () {jquery (' #  Selectedval '). Val (');  })          }); })

  

Work notes-front page paging data echo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.