Set the timeout (timeout) method when BootstrapTable requests data. connecttimeout times out.
When you use bootstrapTable to obtain data, sometimes the data cannot be obtained in time due to network or server reasons, and the page is always waiting. To improve the effect, consider setting the timeout. After the request is sent, no data is displayed, and the request is re-initiated after a period of time.
In implementation, bootstrapTable obtains data through ajax. You can use the ajaxOptions option to set some attributes of ajax.
To set timeout for bootstrapTable, set the async attribute to true. In bootstrapTable, the default value of async is false. For example
$("#event_table").bootstrapTable({ url: urlAddr, ajaxOptions: {async:true,timeout:5000},});
In addition, adding ajaxOptions using the refresh method does not work:
$(“#event_table”).bootstrapTable('refresh', { url: api_url, ajaxOptions:{async:true,timeout:1000}});
The reason remains to be further investigated.
Next, let's take a look at how to know if table data is successfully loaded when bootstrapTable is used to obtain data?
BootstrapTable provides a special loadsuccess method to reflect whether data is successfully loaded.
$table.on('load-success.bs.table',function(data){ console.log("load success"); });
BootstrapTable user documentation, see http://bootstrap-table.wenzhixin.net.cn/documentation/
Refer:
Difference between refresh and refreshOptions of boostrapTable
The above section describes how to set a timeout value for BootstrapTable data request. I hope it will be helpful to you. If you have any questions, please leave a message, the editor will reply to you in a timely manner. Thank you very much for your support for the help House website!