全网整合营销服务商

电脑端+手机端+微信端=数据同步管理

免费咨询热线:400-708-3566

jQuery中table数据的值拷贝和拆分

在开发的过程中,经常会遇到弹出框显示前一页table列表的情况,这时候会有好多方法来来解决,有的人可能会说重新查一遍数据显示,有的人会说直接用js将值拷贝过去,然后再修改,不过现在就介绍怎么用jquery将值拷贝到第二页并拆分拷贝的值。

       母页显示数据格式如下:

 <div class="materialCode stdtable">
      <h2>发货情况</h2>
      <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 src="${deliverGoodsDetaiList.goodsImage}">
                  <div>
                    <c:if test="${orderDetail.orderForm.orderType =='2' }">
                      <h5><a href="javascript:void(0);" rel="external nofollow" >${deliverGoodsDetaiList.goodsName}</a></h5>
                    </c:if>
                    <c:if test="${orderDetail.orderForm.orderType !='2' }">
                      <h5><a href="${URL_WWW}/shop/index.php?act=goods&goods_id=${deliverGoodsDetaiList.goodsId}" rel="external nofollow" >${deliverGoodsDetaiList.goodsName}</a></h5>
                    </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" style="display: none;">
                      <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="确认收货" 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" style="display:none;z-index: 1000; width: 900px; height:500px;left: 50%; position: fixed; top:30%;margin-left:-450px;margin-top:-125px;padding-bottom:20px;">
    <div class="title">
      <h2>确认收货数量</h2>
      <div>
        <a class="min" href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="最小化" style="display:none;"></a>
        <a class="max" href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="最大化" style="display:none;"></a>
        <a class="revert" href="javascript:;" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" title="还原" style="display:none;"></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" style="height:96%;">
      <div style="height:70%;overflow: auto;">
        <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" style="color:#FF9400;">请仔细核对收货数量后确认</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" style="position: absolute;bottom: 30px;left:0;width:100%;">
        <div class="ordSure_btn" style="width:100px; margin-left:30%; float:left; margin-top: 0;" onclick="comformDeliver()">确定</div>
        <div class="ordCancel_btn" style="width:100px; margin-left:10%; float:left; margin-top: 0;">取消</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  # jQuery使用$.extend(true  # object1  # object2);实现深拷贝对象的方法分析  # jQuery深拷贝Json对象简单示例  # jQuery的$.extend 浅拷贝与深拷贝  # 详解jQuery的拷贝对象  # 收货  # 弹出  # 会说  # 有的人  # 会有  # 暂无  # 一遍  # 并将  # 然后再  # 来实现  # 来来  # 经常会  # 小编  # 过程中  # 有任何  # 这时候  # 数据格式  # 请仔细  # 拷贝到  # flag 


相关文章: 微信小程序 input输入框控件详解及实例(多种示例)  建站之星如何开启自定义404页面避免用户流失?  制作网站软件推荐手机版,如何制作属于自己的手机网站app应用?  制作网站的软件下载免费,今日头条开宝箱老是需要下载怎么回事?  安徽网站建设与外贸建站服务专业定制方案  如何通过智能用户系统一键生成高效建站方案?  制作网站公司那家好,网络公司是做什么的?  交易网站制作流程,我想开通一个网站,注册一个交易网址,需要那些手续?  整人网站在线制作软件,整蛊网站退不出去必须要打我是白痴才能出去?  头像制作网站在线观看,除了站酷,还有哪些比较好的设计网站?  建站之星后台密码遗忘或太弱?如何重置与强化?  如何配置支付宝与微信支付功能?  平台云上自助建站如何快速打造专业网站?  如何通过宝塔面板实现本地网站访问?  网站广告牌制作方法,街上的广告牌,横幅,用PS还是其他软件做的?  大连企业网站制作公司,大连2025企业社保缴费网上缴费流程?  建站之星安装路径如何正确选择及配置?  如何通过西部数码建站助手快速创建专业网站?  宝塔建站教程:一键部署配置流程与SEO优化实战指南  为什么Go需要go mod文件_Go go mod文件作用说明  如何通过FTP空间快速搭建安全高效网站?  如何用低价快速搭建高质量网站?  公众号网站制作网页,微信公众号怎么制作?  建站主机如何安装配置?新手必看操作指南  大同网页,大同瑞慈医院官网?  如何用5美元大硬盘VPS安全高效搭建个人网站?  香港服务器建站指南:免备案优势与SEO优化技巧全解析  微信网站制作公司有哪些,民生银行办理公司开户怎么在微信网页上查询进度?  建站与域名管理如何高效结合?  东莞专业网站制作公司有哪些,东莞招聘网站哪个好?  阿里云网站制作公司,阿里云快速搭建网站好用吗?  专业网站制作企业网站,如何制作一个企业网站,建设网站的基本步骤有哪些?  如何在云主机快速搭建网站站点?  清单制作人网站有哪些,近日“兴风作浪的姑奶奶”引起很多人的关注这是什么事情?  网站制作专业公司有哪些,如何制作一个企业网站,建设网站的基本步骤有哪些?  建站之星3.0如何解决常见操作问题?  网站制作公司广州有几家,广州尚艺美发学校网站是多少?  阿里云高弹*务器配置方案|支持分布式架构与多节点部署  零基础网站服务器架设实战:轻量应用与域名解析配置指南  青浦网站制作公司有哪些,苹果官网发货地是哪里?  建站之星如何修改网站生成路径?  如何在阿里云虚拟机上搭建网站?步骤解析与避坑指南  logo在线制作免费网站在线制作好吗,DW网页制作时,如何在网页标题前加上logo?  建站之星与建站宝盒如何选择最佳方案?  网站制作费用多少钱,一个网站的运营,需要哪些费用?  c++怎么实现高并发下的无锁队列_c++ std::atomic原子变量与CAS操作【详解】  创业网站制作流程,创业网站可靠吗?  高防服务器:AI智能防御DDoS攻击与数据安全保障  红河网站制作公司,红河事业单位身份证如何上传?  rsync同步时出现rsync: failed to set times on “xxxx”: Operation not permitted 

您的项目需求

*请认真填写需求信息,我们会在24小时内与您取得联系。