Select/Option is losing its class when navigating back

Select/Option is losing its class when navigating back

HillChris1234HillChris1234 Posts: 27Questions: 13Answers: 2

I have a DataTable that uses serverSide processing. One of the columns is defined like this:
"data": function (row, type, val, meta) {
return "<select class='selectpicker'>" +
"<option value='1'>Test Value</option>" +
"</select>";
}

Works great. But, when I click on a link on this page, then navigate back, the dropdown loses the "selectpicker" class. Why? I need the dropdown to retain that class because I have events that depend on it being present.

Answers

  • HillChris1234HillChris1234 Posts: 27Questions: 13Answers: 2
    edited May 2016

    It seems to be completely random. When it's the only column being returned in the grid, it seems to work most of the time, but usually it's totally broken.

  • HillChris1234HillChris1234 Posts: 27Questions: 13Answers: 2
    edited May 2016

    This doesn't even work.

    $('select').addClass("selectpicker");

    It'll apply the style to the "show __ entries" dropdown, but not the one in the grid:

This discussion has been closed.