gvhjb 2021-05-17 00:47 采纳率: 75%
浏览 83
已采纳

新加入的<td>内容 一涉及到要刷新table内容的操作 新加入的就没了

代码如下:

<tbody>
<c:forEach items="${requestScope.productList}" var="product">
    <tr>
        <td><input type="checkbox" class="cbx_select" id="cbx_product_select_${product.product_id}"><label for="cbx_product_select_${product.product_id}"></label></td>
        <td title="${product.product_name}">${product.product_name}</td>
        <td title="${product.product_title}">${product.product_title}</td>
        <td title="${product.product_price}">${product.product_price}</td>
        <td title="${product.product_sale_price}">${product.product_sale_price}</td>
        <td title="${product.product_create_date}">${product.product_create_date}</td>
        <td>
            <c:choose>
                <c:when test="${product.product_isEnabled==0}"><span class="td_success" title="产品正常销售中">销售中</span></c:when>
                <c:when test="${product.product_isEnabled==2}"><span class="td_warn" title="产品显示在主页促销中">促销中</span></c:when>
                <c:otherwise><span class="td_error" title="产品缺货或违规停售中">停售中</span></c:otherwise>
            </c:choose>
        </td>
        <td><span class="td_special" title="查看产品详情"><a href="javascript:void(0)" onclick="getChildPage(this)">详情</a></span></td>
        <strong><span class="td_special" title="删除产品"><a href="${pageContext.request.contextPath}/order/deliveryss/${product.product_id}">删除</a></span></strong>
      <td hidden><span class="product_id">${product.product_id}</span></td>
    </tr>
</c:forEach>
</tbody>

删除产品那里总是一点击下一页或者查询 涉及到更新table内容的 删除就没有了

 

  tbody.append("<tr><td><input type='checkbox' class='cbx_select' id='cbx_product_select_" + product_id + "'><label for='cbx_product_select_" + product_id + "'></label></td><td title='"+product_name+"'>" + product_name + "</td><td title='"+product_title+"'>" + product_title + "</td><td title='"+product_price+"'>" + product_price + "</td><td title='"+product_sale_price+"'>" + product_sale_price + "</td><td title='"+product_create_date+"'>" + product_create_date + "</td><td><span class='" + isEnabledClass + "' title='"+isEnabledTitle+"'>"+ isEnabled +
        "</span></td><td><span class='td_special' title='查看产品详情'><a href='javascript:void(0);' onclick='getChildPage(this)'>详情</a></span>"
        + " "+ "<span class='td_special' title='删除产品'><a href=''${pageContext.request.contextPath}''/order/deliveryss/'${product.product_id}''>删除</a></span></td><td hidden><span class='product_id'>"
        + product_id + "</span></td></tr>");
}
  • 写回答

4条回答 默认 最新

  • CSDN专家-showbo 2021-05-17 09:07
    关注

    分页是通过ajax异步加载吗?还是通过连接网址刷新过页面加载的?

    ajax的话检查重新生成dom对象的代码,是不是忘记把删除按钮加上了。

    链接刷新请求同一个页面,如果不显示,用浏览器开发工具检查下是不是删除按钮被隐藏了

    ------------------------------新增修改--------------------------------

     

    <span class='td_special' title='删除产品'><a href=''${pageContext.request.contextPath}''/order/deliveryss/'${product.product_id}''>删除</a></span></td><td hidden><span class='product_id'>

     

    你这里脚本字符串拼接错误,href属性被截断了,并且你这个代码不能放到js文件里面,因为js文件不支持服务标签${pageContext.request.contextPath},你的这个js代码必须要放在jsp之类的服务器端文件script里面,这样${pageContext.request.contextPath}这种标签才能解析

    ====>改成下面的

    
      tbody.append("<tr><td><input type='checkbox' class='cbx_select' id='cbx_product_select_" + product_id + "'><label for='cbx_product_select_" + product_id + "'></label></td><td title='"+product_name+"'>" + product_name + "</td><td title='"+product_title+"'>" + product_title + "</td><td title='"+product_price+"'>" + product_price + "</td><td title='"+product_sale_price+"'>" + product_sale_price + "</td><td title='"+product_create_date+"'>" + product_create_date + "</td><td><span class='" + isEnabledClass + "' title='"+isEnabledTitle+"'>"+ isEnabled +
            "</span></td><td><span class='td_special' title='查看产品详情'><a href='javascript:void(0);' onclick='getChildPage(this)'>详情</a></span>"
            + " "+ "<span class='td_special' title='删除产品'><a href='${pageContext.request.contextPath}/order/deliveryss/${product.product_id}'>删除</a></span></td><td hidden><span class='product_id'>"
            + product_id + "</span></td></tr>");
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能