admin管理员组

文章数量:1417070

I use bootstrap table for table management. I have a table with checkboxes, so I have used data-click-to-select = "true" I also have a search bar I used data-search = "true" When I select an item and I do a search I lose the item that was selected.

In the attached link an example: you select the first element "bootstrap-table" and after you put "b" in zone of search then the element will no longer be selected

1999

Fiddle

Any idea plz

I use bootstrap table for table management. I have a table with checkboxes, so I have used data-click-to-select = "true" I also have a search bar I used data-search = "true" When I select an item and I do a search I lose the item that was selected.

In the attached link an example: you select the first element "bootstrap-table" and after you put "b" in zone of search then the element will no longer be selected

1999

Fiddle

Any idea plz

Share Improve this question edited Jan 4, 2017 at 10:57 Ionut Necula 11.5k4 gold badges49 silver badges72 bronze badges asked Jan 4, 2017 at 10:37 el ogri amineel ogri amine 531 silver badge6 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

You can use data-maintain-selected="true" to keep the selected checkbox.

Updated FIDDLE.

<table data-maintain-selected="true" data-toggle="table" data-url="/gh/get/response.json/wenzhixin/bootstrap-table/tree/master/docs/data/data1/" data-click-to-select="true" data-search="true">
  <thead>
    <tr>
      <th data-field="state" data-checkbox="true"></th>
      <th data-field="name">Name</th>
      <th data-field="stargazers_count">Stars</th>
    </tr>
  </thead>
</table>

You can read more about data-maintain-selected here.

data-maintain-meta-data="true"

...to maintain the following meta data on change page and search.

You can read more about data-maintain-selected here.

本文标签: javascriptThe selected item is lost after searchingBootstrap table afterStack Overflow