jQuery中table数据值的拷贝和拆分
短信预约 -IT技能 免费直播动态提醒
本篇内容介绍了“jQuery中table数据值的拷贝和拆分”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
在开发的过程中,经常会遇到弹出框显示前一页table列表的情况,这时候会有好多方法来来解决,有的人可能会说重新查一遍数据显示,有的人会说直接用js将值拷贝过去,然后再修改,不过现在就介绍怎么用jquery将值拷贝到第二页并拆分拷贝的值。
母页显示数据格式如下:
<div class="materialCode stdtable">
<h3>发货情况</h3>
<ul class="theadUl clearfix">
<li class="td1">发货批次</li>
<li class="td2">商品</li>
<li class="td3">发货数量</li>
<li class="td4">剩余数量</li>
<li class="td5">收货数量</li>
<li class="td6">收货状态</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 class="lazy" data-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' }">
待发货
</c:if>
<c:if test="${deliverGoodsList.deliveryStatus =='20' }">
待确认收货
</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 class="lazy" data-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="确认收货" 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">暂无发货信息</td>
</tr>
</tbody>
</c:if>
</table>
</div>
</div>
如下是弹出框显示页:
<div id="messageBoxWin" class="popup" >
<div class="title">
<h3>确认收货数量</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="关闭"></a>
</div>
</div>
<div class="content" >
<div >
<table class="recieveCount">
<thead>
<tr>
<th class="td1 ">发货批次</th>
<th class="td2 ">商品</th>
<th class="td3 ">发货数量</th>
<th class="td4 ">剩余</th>
<th class="td5 ">收货数量</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="8" >请仔细核对收货数量后确认</td>
</tr>
<%--<input type="button" name="" value="确认" 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数据值的拷贝和拆分”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注编程网网站,小编将为大家输出更多高质量的实用文章!
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341