The selected item is lost after searching-Bootstrap table after

Question

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


Show source
| javascript   | jquery   | twitter-bootstrap-3   2017-01-04 11:01 1 Answers

Answers ( 1 )

  1. 2017-01-04 11:01

    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.

◀ Go back