Bootstrap 4 引导数据表:使用来自服务器的数据重新绑定

Bootstrap 4 引导数据表:使用来自服务器的数据重新绑定,bootstrap-4,datatables,Bootstrap 4,Datatables,我正在页面上使用引导数据表。以下代码是标记: <div id="toolbar"> <div class="row searchbydate"> <div class="col-md-3"> <div class="form-group row m-0"> <label for=" " class="col-sm-4 col-form-label">Keyword </label&g

我正在页面上使用引导数据表。以下代码是标记:

<div id="toolbar">
<div class="row searchbydate">
    <div class="col-md-3">
        <div class="form-group row m-0">
            <label for=" " class="col-sm-4 col-form-label">Keyword </label>
            <div class="col-sm-8">
                <input type="text" class="form-control" id="txtKeyWord">
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="form-group row m-0">
            <label for=" " class="col-sm-4 col-form-label">From Date </label>
            <div class="col-sm-8">
                <input type="date" class="form-control" id="txtFromDate">
            </div>
        </div>
    </div>
    <div class="col-md-4">
        <div class="form-group row m-0">
            <label for=" " class="col-sm-4 col-form-label">To Date </label>
            <div class="col-sm-8">
                <input type="date" class="form-control" id="txtToDate">
            </div>
        </div>
    </div>
    <div class="col-md-1"> <button type="button" class="btn btn-primary" id="btnSearch"><i class="fa fa-search"></i> </button> </div>
</div>
</div>
<table id="myBookingsTable"
   data-toolbar="#toolbar"
   data-url="GetList"
   data-show-refresh="true"
   data-show-toggle="true"
   data-show-fullscreen="true"
   data-show-columns="true"
   data-show-columns-toggle-all="true"
   data-show-export="true"
   data-click-to-select="true"
   data-minimum-count-columns="2"
   data-show-pagination-switch="true"
   data-pagination="true"
   data-id-field="id"
   data-page-list="[10, 25, 50, 100, all]"
   data-side-pagination="server"
   data-response-handler="responseHandler">
</table>
我需要从以下函数重新绑定表:

function RebindTableFromData(){
//I am able to get the data here from the server based on extra keywords. Need to refresh the table 
//with this data
}
我可以根据额外的关键字从服务器获取数据。需要使用此数据刷新表。有没有一种方法可以使用JS/JQuery实现这一点

使用服务器上新更新的JSON更新数据。您需要清除所有行,并使用更新的JSON数据添加新行


这有用吗@astm1982
function RebindTableFromData(){
//I am able to get the data here from the server based on extra keywords. Need to refresh the table 
//with this data
}
myDataTable.clear(); // Clear your data
myDataTable.rows.add(tabledata); // Add rows with newly updated data
myDataTable.draw(); //then draw it