为了账号安全,请及时绑定邮箱和手机立即绑定

通过 AJAX 刷新所有 dataTable 页面成为一个页面

通过 AJAX 刷新所有 dataTable 页面成为一个页面

MMMHUHU 2021-09-30 10:19:58
我以某种方式设法实现了它,不幸的是客户端数据表在刷新时被破坏了。通过销毁,dataTable 中的所有数据都在一个页面中。这是桌子。<table id="earnings_amendment_account" class="table table-bordered" style="table-layout: fixed; display: none">                <thead>                <th></th>                  <th>Account Code</th>                  <th>Account Title</th>                  <th>Account Type</th>                  <th>Tools</th>                </thead><tbody id="table-body"> <?php include 'tableBody.php';?>                </tbody>              </table>这是 tableBody.php<?php include 'backend/conn.php'; ?>                                  <?php                    $params=array();                    $sql = "SELECT accountcode,accounttype,accounttitle,accounttype,postedby,dateposted,approvedby,dateapproved FROM earningsamendmentaccount";$query = sqlsrv_query($conn, $sql, $params, array("Scrollable" => SQLSRV_CURSOR_KEYSET));if ($query === false ) { echo "Error (sqlsrv_query): ".print_r(sqlsrv_errors(), true); exit; }                     while($row = sqlsrv_fetch_array($query, SQLSRV_FETCH_ASSOC)){                      echo "                      <tr data-key-1='".$row['postedby']."' data-key-2='".$row['dateposted']."' data-key-3='".$row['approvedby']."' data-key-4='".$row['dateapproved']."'>                        <td class='details-control'></td>                        <td>".$row['accountcode']."</td>                          <td>".$row['accounttitle']."</td>                          <td>".$row['accounttype']."</td>                          <td>有没有办法解决这个问题?
查看完整描述

1 回答

?
慕森卡

TA贡献1806条经验 获得超8个赞

尝试使用您的数据表对象 var earnings_amendment_account_table = $('#earnings_amendment_account').DataTable({});

所以在你的jQuery/AJAX - (earnings_amendment_account.php)更改$("#earnings_amendment_account").DataTable().ajax.reload();earnings_amendment_account_table.ajax.reload();


查看完整回答
反对 回复 2021-09-30
  • 1 回答
  • 0 关注
  • 216 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信