wenzhixin/bootstrap-table — pull request #367 by tristanlee85 (2014-12-22 14:54:00+00:00)
Title: Allow query params to be specified during refresh

When refreshing remote data, it may be required to optionally refresh with query params. Granted the data-query-params attribute is available, this function is not in the scope of the selected row, thus any row-specific data that might be used as a query param is not available.

// called via data-query-params
window.setQueryParams = function (params) {
// apply query params in the table's dataset to the default params
return $.extend(params, $bst.data("queryparams"));
}

$bst.on("click-row.bs.table", function (e, row, $element) {
// set row-specific query params prior to refresh
var data = {};
data[row.argument] = row.id;
$bst.data("queryparams", data);

$table.bootstrapTable("refresh");
});

With the `queryparams` option, you can pass them directly to the request rather storing them globally to have the queryparam function apply them on every request:

$bst.on("click-row.bs.table", function (e, row, $element) {
var data = {};
data[row.argument] = row.id;

// pass scope-specific params directly to the request
$table.bootstrapTable("refresh", {queryparams: $.extend(params, data)});
});