Reputation: 199
I need to get data from Bootstrap table just after refreshing the table which is getting the data from AJAX request.
table.bootstrapTable('refresh');
var data = table.bootstrapTable('getData');
This gives me the data which was before calling an AJAX - I think it's because getData is called before refresh is fully completed. I've search for an event that triggers after refresh is done, but there's no one.
Getting it by value of DOM element gives me the same result. Calling delay()
is not the option at all. Do you have any idea how to do it?
The code is a bit complicated (in a few functions) but:
post.done(function(data) {
//...some code
table.bootstrapTable('refresh');
$this.updateSomethingInTable(table);
})
updateSomethingInTable= function(detailsTable) {
//...some code
var detailsTableData = detailsTable.bootstrapTable('getData');
//updating something with detailsTableData
}
Upvotes: 0
Views: 4011
Reputation: 33
EDITED:
$('#table').on('load-success.bs.table', function() {
// your code to get data
});
http://bootstrap-table.wenzhixin.net.cn/documentation/#events
I've test on testing on this jsfiddle: http://jsfiddle.net/e3nk137y/16571/
Upvotes: 1