您好,登錄后才能下訂單哦!
本篇內(nèi)容介紹了“jQuery中table數(shù)據(jù)值的拷貝和拆分”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細(xì)閱讀,能夠?qū)W有所成!
在開發(fā)的過程中,經(jīng)常會遇到彈出框顯示前一頁table列表的情況,這時候會有好多方法來來解決,有的人可能會說重新查一遍數(shù)據(jù)顯示,有的人會說直接用js將值拷貝過去,然后再修改,不過現(xiàn)在就介紹怎么用jquery將值拷貝到第二頁并拆分拷貝的值。
母頁顯示數(shù)據(jù)格式如下:
<div class="materialCode stdtable"> <h3>發(fā)貨情況</h3> <ul class="theadUl clearfix"> <li class="td1">發(fā)貨批次</li> <li class="td2">商品</li> <li class="td3">發(fā)貨數(shù)量</li> <li class="td4">剩余數(shù)量</li> <li class="td5">收貨數(shù)量</li> <li class="td6">收貨狀態(tài)</li> <li class="td7">操作</li> </ul> <table id="table1"> <thead> <tr> <th class="td1"></th> <th class="td2"></th> <th class="td3"></th> <th class="td4"></th> <th class="td5"></th> <th class="td6"></th> <th class="td7"></th> </tr> </thead> <tbody> <c:forEach var="deliverGoodsList" items="${orderDetail.deliverGoodsList}" varStatus="outer"> <c:forEach var="deliverGoodsDetaiList" items="${deliverGoodsList.deliverGoodsDetaiList}" varStatus="inner"> <tr flag="${deliverGoodsList.deliverGoodsId}" orderId="${deliverGoodsList.orderId}" goodsId="${deliverGoodsDetaiList.goodsId}"> <c:if test="${inner.index == 0}"> <td rowspan="${deliverGoodsList.deliverGoodsDetaiList.size()}">${outer.index+1}</td> </c:if> <td> <div class="ord_product"><img src="${deliverGoodsDetaiList.goodsImage}"> <div> <c:if test="${orderDetail.orderForm.orderType =='2' }"> <h6><a href="javascript:void(0);" rel="external nofollow" >${deliverGoodsDetaiList.goodsName}</a></h6> </c:if> <c:if test="${orderDetail.orderForm.orderType !='2' }"> <h6><a href="${URL_WWW}/shop/index.php?act=goods&goods_id=${deliverGoodsDetaiList.goodsId}" rel="external nofollow" >${deliverGoodsDetaiList.goodsName}</a></h6> </c:if> </div> </div> </td> <td>${deliverGoodsDetaiList.deliveryNum}</td> <td>${deliverGoodsDetaiList.overplusNum}</td> <td>${deliverGoodsDetaiList.takeDeliveryNum}</td> <c:if test="${inner.index == 0}"> <td rowspan="${deliverGoodsList.deliverGoodsDetaiList.size()}"> <c:if test="${deliverGoodsList.deliveryStatus =='10' }"> 待發(fā)貨 </c:if> <c:if test="${deliverGoodsList.deliveryStatus =='20' }"> 待確認(rèn)收貨 </c:if> <c:if test="${deliverGoodsList.deliveryStatus =='30' }"> 已收貨 </c:if> <c:if test="${deliverGoodsList.deliveryStatus =='40' }"> 退貨 </c:if> </td> </c:if> <c:if test="${inner.index == 0}"> <td rowspan="${deliverGoodsList.deliverGoodsDetaiList.size()}"><a href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="pr beizhu">查看備注 <div class="beizhu_msg beizhu_msg_li" > <img src="${URL_LIB}/static/order/images/sanjiao_orange.png"> <p>${deliverGoodsList.logisticsRemark}</p> </div> </a> <c:if test="${deliverGoodsList.deliveryStatus !='30' }"> <input type="button" name="" value="確認(rèn)收貨" class="dayin" onclick="showDeliver(${deliverGoodsList.deliverGoodsId})" > </c:if> </td> </c:if> <%--<td>${deliverGoodsDetaiList.goodsId}</td>--%> </c:forEach> </tr> </c:forEach> </tbody> <c:if test="${empty orderDetail.deliverGoodsList}"> <tbody> <tr class="opt_zanwu"> <td colspan="7">暫無發(fā)貨信息</td> </tr> </tbody> </c:if> </table> </div> </div>
如下是彈出框顯示頁:
<div id="messageBoxWin" class="popup" > <div class="title"> <h3>確認(rèn)收貨數(shù)量</h3> <div> <a class="min" href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="最小化" ></a> <a class="max" href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="最大化" ></a> <a class="revert" href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="還原" ></a> <a class="close" href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="關(guān)閉"></a> </div> </div> <div class="content" > <div > <table class="recieveCount"> <thead> <tr> <th class="td1 ">發(fā)貨批次</th> <th class="td2 ">商品</th> <th class="td3 ">發(fā)貨數(shù)量</th> <th class="td4 ">剩余</th> <th class="td5 ">收貨數(shù)量</th> </tr> </thead> <tbody> <tr> <td colspan="8" >請仔細(xì)核對收貨數(shù)量后確認(rèn)</td> </tr> <%--<input type="button" name="" value="確認(rèn)" class="ordSure_btn" onclick="comformDeliver(${deliverGoodsList.orderId},${deliverGoodsList.deliverGoodsId})">--%> <%--<input type="button" name="" value="取消" class="ordSure_btn" >--%> </tbody> </table> </div> <div class="bot_btns" > <div class="ordSure_btn" onclick="comformDeliver()">確定</div> <div class="ordCancel_btn" >取消</div> </div> </div> </div> </div>
如下為jquery代碼顯示:
function showDeliver(deliverId){ var delitems= $("#table1 tr[flag='"+deliverId+"']").clone(); $(delitems).each(function(index){ if(index==0){ $($(this).find("td")[6]).remove(); $($(this).find("td")[5]).remove(); var deliverNum = $($(this).find("td")[2]).text(); var inputHTML="<input type='text' onblur='checkAcount(this);' class='sum' value='"+deliverNum+"'>" $($(this).find("td")[4]).empty(); $($(this).find("td")[4]).append(inputHTML); }else{ var deliverNum= $($(this).find("td")[1]).text(); var inputHTML="<input type='text' onblur='checkAcount(this);' class='sum' value='"+deliverNum+"'>" $($(this).find("td")[3]).empty(); $($(this).find("td")[3]).append(inputHTML); } }); $("#messageBoxWin table tbody").empty(); $("#messageBoxWin table tbody").append(delitems); deliverGoodsId=deliverId; }
“jQuery中table數(shù)據(jù)值的拷貝和拆分”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。