1

I am learning to use Search feature of the extended Bootstrap Table. I declare a table with the following:

<table class="table table-striped table-bordered table-hover
   table-condensed" id="my_table" border="1"
   data-toggle="table" data-sortable="true"
   data-sort-name="creation_time" data-sort-order="desc"
   data-pagination="true" data-page-size="30"
   data-search="true" data-height="760">

...
</table>

The Search text box is shown as expected. But, I have two problems:

  1. How can I specify the destination url for submitting the search text?
  2. How to prevent submitting search request when no search text is entered in the search text box?

Can anyone help?

4

1 回答 1

2

您可以设置 data-url 和 data-query-params 选项来解决您的问题:

<table data-url="your destination url" data-query-params="queryParams" ...></table>

function queryParams(params) {
    if (!params.search) {
        return false; // Return false to stop request.
    }
    return params;
}

这是文档:http ://bootstrap-table.wenzhixin.net.cn/documentation/ ,示例:http: //issues.wenzhixin.net.cn/bootstrap-table/index.html

于 2015-04-17T02:11:00.347 回答