I want to execute code after bootstrap table update.
I have wrote following code:
$selectProductTable.bootstrapTable('refreshOptions', {
url: REST_PRODUCT_PREFIX + '/list',
ajaxOptions: {
headers: {
"Authorization": "Bearer " + token
}
},
success: function() {
updateUserInformation($("#userId").val())
}
});
But succes doesn't invoke.
Can you help to achieve it?
Take a look at: https://github.com/wenzhixin/bootstrap-table/blob/develop/dist/bootstrap-table.js#L2014-L2033
Specifically line 2026. You can see there that on success of the ajax call it triggers an event called: 'load-success.bs.table'.
You can listen to this event doing something like this:
$table.on('load-success.bs.table', function (res) {
console.log('this is the response from the ajax call: ' + JSON.stringify(res, null, 2));
})
http://jsfiddle.net/cm44uL3v/2/
The event is called: onLoadSuccess
and you can find a description of what it does here: http://bootstrap-table.wenzhixin.net.cn/documentation/#events
$selectProductTable.bootstrapTable({
method: 'get',
...
onLoadSuccess: function(status, res) {
// do something
},
...
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With