How to update data in the boot table

I have one boot table with the following code.

  <table id="tblPendingRequests" data-height="300">
       <thead>
          <tr>
             <th data-field="Version">Version</th>
             <th data-field="Env">Env</th>
             <th data-field="Release">Release</th>
             <th data-field="CreatedBy">Created By</th>
             <th data-field="Action">Action</th>
          </tr>
      </thead>
   </table>

links are added below.

<script src="~/Scripts/bootstrap-table.js"></script>
<link href="~/Content/bootstrap-table.min.css" rel="stylesheet" />

and my jquery code to load data

     function loadData()
     {
       $(function () {
        $('#tblPendingRequests').bootstrapTable({
        });
      });
     }

and then I load some data into this table. Like this:

var mydata = { "Version": data[index].DeploymentName, "Env": data[index].EnvName, 
                  "Release":data[index].ReleaseName, "CreatedBy": data[index].UpdatedBy  "Action": ActionButton };
            testData.push(mydata);
      updateData(testData);
  function updateData(myData) {
     $('#tblPendingRequests').bootstrapTable("append", myData);

      }

This correctly documents the data. I have one dropdown menu per page. When replacing the project name, I want to populate this table with new data. This is not happening. This is adding data to existing tabular data that I do not want.

How to update the table and load new data into the table.

+4
source share
2 answers

Try using loadinstead append.

From the official documentation

- .

load. , .

data.

+4

$('#tblPendingRequests').bootstrapTable("destroy");, , $('#tblPendingRequests').bootstrapTable({data: myFreshData});.

, load , , 1000 .

+2

Source: https://habr.com/ru/post/1570872/


All Articles