Bootstrap-table: How to change remote url?

Created on 11 Aug 2014  ·  4Comments  ·  Source: wenzhixin/bootstrap-table

Hi,
I'm going to test your library.
I cannot found a method to change url, after first table bind.
Setting another url don't change visualized data.
I'm trying successfully this add:

BootstrapTable.prototype.refreshUrl = function (options) {
    this.options.url = options.url;
    this.initServer();
};

Any suggestions?

Thank you. Regards.

Most helpful comment

$('#table').bootstrapTable('refresh', {url: 'new url'}); no work ,数据还是来自旧的url查询条件没有了

All 4 comments

$('#table').bootstrapTable('refresh', {url: 'new url'});

Thanks

$('#table').bootstrapTable('refresh', {url: 'new url'}); no work ,数据还是来自旧的url查询条件没有了

I can confirm, that @wenzhixin solution does not work. It does not change data-url permanently. Defined URL is changed (used) just for 1 data load.
This is how I did it for now:

var $detailTable = $('#appsDetailTable');
var options = $detailTable.bootstrapTable('getOptions');
options.url = '/apps/detailData2';
$detailTable.bootstrapTable('refreshOptions', options);
$detailTable.bootstrapTable('refresh');
Was this page helpful?
0 / 5 - 0 ratings