更新发生后,.bootstrapTable执行代码

gst*_*low 12 javascript jquery html-table css-tables twitter-bootstrap

我想在bootstrap表更新后执行代码.

我写了以下代码:

     $selectProductTable.bootstrapTable('refreshOptions', {
        url: REST_PRODUCT_PREFIX + '/list',
        ajaxOptions: {
            headers: {
                "Authorization": "Bearer " + token
            }
        },
        success: function() {
            updateUserInformation($("#userId").val())
        }
    });
Run Code Online (Sandbox Code Playgroud)

但成功并没有引用.

你能帮忙实现吗?

m1.*_*m1. 5

看看:https : //github.com/wenzhixin/bootstrap-table/blob/develop/dist/bootstrap-table.js#L2014-L2033

特别是第2026行。您可以在那里看到成功调用ajax会触发一个名为“ load-success.bs.table”的事件。

您可以听此事件执行以下操作:

  $table.on('load-success.bs.table', function (res) {
    console.log('this is the response from the ajax call: ' + JSON.stringify(res, null, 2));
  })
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/cm44uL3v/2/

该事件称为:onLoadSuccess您可以在此处找到对其的描述:http : //bootstrap-table.wenzhixin.net.cn/documentation/#events