新加入的<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>");
}

分页是通过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>");

 

F12你看下控制台是否报错,以及查看元素,是否存在删除相关标签。

这个增删改查,是调用的接口吧?只能看看接口传参是否有误和接口返回数据是否有误。确定问题

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632