Selectpicker / DataTables incompatibility

Selectpicker / DataTables incompatibility

HillChris1234HillChris1234 Posts: 27Questions: 13Answers: 2

Is there a solution to the incompatibility between the Selectpicker plugin and DataTables? If I have a select that uses the bootstrap selectpicker plugin, it works when the page loads. But any (serverSide) callback causes the selectpicker plugin to not work. I can add $(".selectpicker").selectpicker(); to the end of the "column" script that creates that particular column, but it only works in some situations. If I use the search bar, when the table refreshes, it reverts to a normal drop down.

Answers

  • allanallan Posts: 63,791Questions: 1Answers: 10,513 Site admin

    Since server-side processing will create new rows on each draw, and the select picker is only initialising what it can find on the document (or more specifically what you select with the jQuery select), you need to run that initialisation in the drawCallback option.

    Allan

This discussion has been closed.