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


相关推荐: 如何快速上传建站程序避免常见错误?  中国移动官方网站首页入口 中国移动官网网页登录  浅析上传头像示例及其注意事项  Laravel辅助函数有哪些_Laravel Helpers常用助手函数大全  如何快速打造个性化非模板自助建站?  如何选择PHP开源工具快速搭建网站?  如何快速生成橙子建站落地页链接?  郑州企业网站制作公司,郑州招聘网站有哪些?  php读取心率传感器数据怎么弄_php获取max30100的心率值【指南】  iOS发送验证码倒计时应用  制作网站软件推荐手机版,如何制作属于自己的手机网站app应用?  香港服务器部署网站为何提示未备案?  Laravel怎么清理缓存_Laravel optimize clear命令详解  作用域操作符会触发自动加载吗_php类自动加载机制与::调用【教程】  齐河建站公司:营销型网站建设与SEO优化双核驱动策略  如何在Windows环境下新建FTP站点并设置权限?  Laravel如何创建自定义中间件?(Middleware代码示例)  海南网站制作公司有哪些,海口网是哪家的?  如何确保FTP站点访问权限与数据传输安全?  Mybatis 中的insertOrUpdate操作  标准网站视频模板制作软件,现在有哪个网站的视频编辑素材最齐全的,背景音乐、音效等?  如何用花生壳三步快速搭建专属网站?  Laravel如何实现登录错误次数限制_Laravel自带LoginThrottles限流配置【方法】  如何在IIS中配置站点IP、端口及主机头?  香港服务器租用费用高吗?如何避免常见误区?  Gemini手机端怎么发图片_Gemini手机端发图方法【步骤】  微博html5版本怎么弄发语音微博_语音录制入口及时长限制操作【教程】  如何用好域名打造高点击率的自主建站?  在centOS 7安装mysql 5.7的详细教程  如何快速搭建高效WAP手机网站吸引移动用户?  Laravel如何实现多对多模型关联?(Eloquent教程)  Laravel如何处理CORS跨域问题_Laravel项目CORS配置与解决方案  Windows10电脑怎么设置虚拟光驱_Win10右键装载ISO镜像文件  Win11怎么查看显卡温度 Win11任务管理器查看GPU温度【技巧】  浅述节点的创建及常见功能的实现  如何用美橙互联一键搭建多站合一网站?  Python进程池调度策略_任务分发说明【指导】  Laravel Seeder怎么填充数据_Laravel数据库填充器的使用方法与技巧  nodejs redis 发布订阅机制封装实现方法及实例代码  如何用VPS主机快速搭建个人网站?  百度浏览器如何管理插件 百度浏览器插件管理方法  Laravel怎么进行数据库事务处理_Laravel DB Facade事务操作确保数据一致性  网站制作大概多少钱一个,做一个平台网站大概多少钱?  大型企业网站制作流程,做网站需要注册公司吗?  香港服务器网站推广:SEO优化与外贸独立站搭建策略  手机网站制作平台,手机靓号代理商怎么制作属于自己的手机靓号网站?  想要更高端的建设网站,这些原则一定要坚持!  如何在万网利用已有域名快速建站?  js实现获取鼠标当前的位置  高配服务器限时抢购:企业级配置与回收服务一站式优惠方案