user2242044
user2242044

Reputation: 9213

Refreshing a Bootstrap-Table Table with JavaScript Function

I have table built with Bootstrap-Table.

I am working on refreshing the data via Javascript. From the docs, it seems like I should destroy the table, then rebuild it.

I have successfully destroyed the table, but refreshing it does not and there are no errors in the console.

$(function () {
  $rebuild.click(function(){
      $('#table').bootstrapTable('load', data);
  });
});

http://jsfiddle.net/rcr909rx/3/

Documentation: https://github.com/wenzhixin/bootstrap-table/issues/320

Upvotes: 0

Views: 2233

Answers (1)

pbarrasso
pbarrasso

Reputation: 156

You need to use the 'load' function. Destroy isn't required.

Like:

var newData = [
    {"name": "new data!"},
];

$('#table').bootstrapTable('load', {
    data: newData
});

I updated your fiddle: http://jsfiddle.net/qxw5y72f/

Upvotes: 1

Related Questions