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

发布时间 - 2026-01-11 00:14:37    点击率:

在开发的过程中,经常会遇到弹出框显示前一页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 


相关栏目: 【 网站优化151355 】 【 网络推广146373 】 【 网络技术251813 】 【 AI营销90571


相关推荐: javascript中的数组方法有哪些_如何利用数组方法简化数据处理  QQ浏览器网页版登录入口 个人中心在线进入  教学论文网站制作软件有哪些,写论文用什么软件 ?  如何用景安虚拟主机手机版绑定域名建站?  Microsoft Edge如何解决网页加载问题 Edge浏览器加载问题修复  如何有效防御Web建站篡改攻击?  佛山网站制作系统,佛山企业变更地址网上办理步骤?  INTERNET浏览器怎样恢复关闭标签页_INTERNET浏览器标签恢复快捷键与方法【指南】  大型企业网站制作流程,做网站需要注册公司吗?  laravel怎么使用数据库工厂(Factory)生成带有关联模型的数据_laravel Factory生成关联数据方法  javascript中闭包概念与用法深入理解  php在windows下怎么调试_phpwindows环境调试操作说明【操作】  怎么制作一个起泡网,水泡粪全漏粪育肥舍冬季氨气超过25ppm,可以有哪些措施降低舍内氨气水平?  如何在IIS7中新建站点?详细步骤解析  Laravel如何从数据库删除数据_Laravel destroy和delete方法区别  深圳防火门网站制作公司,深圳中天明防火门怎么编码?  Laravel Telescope怎么调试_使用Laravel Telescope进行应用监控与调试  如何用ChatGPT准备面试 模拟面试问答与职场话术练习教程  高防服务器租用指南:配置选择与快速部署攻略  Laravel事件和监听器如何实现_Laravel Events & Listeners解耦应用的实战教程  如何彻底删除建站之星生成的Banner?  北京的网站制作公司有哪些,哪个视频网站最好?  JavaScript中的标签模板是什么_它如何扩展字符串功能  javascript中对象的定义、使用以及对象和原型链操作小结  Laravel如何部署到服务器_线上部署Laravel项目的完整流程与步骤  Zeus浏览器网页版官网入口 宙斯浏览器官网在线通道  晋江文学城电脑版官网 晋江文学城网页版直接进入  如何制作公司的网站链接,公司想做一个网站,一般需要花多少钱?  大连网站制作公司哪家好一点,大连买房网站哪个好?  Python文件操作最佳实践_稳定性说明【指导】  Laravel如何使用Gate和Policy进行权限控制_Laravel权限判定与策略规则配置  常州企业网站制作公司,全国继续教育网怎么登录?  JavaScript Ajax实现异步通信  php8.4header发送头信息失败怎么办_php8.4header函数问题解决【解答】  高端企业智能建站程序:SEO优化与响应式模板定制开发  如何在阿里云虚拟机上搭建网站?步骤解析与避坑指南  绝密ChatGPT指令:手把手教你生成HR无法拒绝的求职信  Laravel路由怎么定义_Laravel核心路由系统完全入门指南  夸克浏览器网页跳转延迟怎么办 夸克浏览器跳转优化  如何在阿里云部署织梦网站?  Linux后台任务运行方法_nohup与&使用技巧【技巧】  html如何与html链接_实现多个HTML页面互相链接【互相】  WEB开发之注册页面验证码倒计时代码的实现  Win11怎么设置虚拟桌面 Win11新建多桌面切换操作【技巧】  Laravel如何使用Passport实现OAuth2?(完整配置步骤)  大连 网站制作,大连天途有线官网?  如何快速搭建个人网站并优化SEO?  laravel服务容器和依赖注入怎么理解_laravel服务容器与依赖注入解析  如何利用DOS批处理实现定时关机操作详解  高防服务器租用如何选择配置与防御等级?