title: MVC: Dropdown Filter of Datatable interferes with UIHints
body: <p>I tried to implement a Dropdown Filter to filter my Datatable like here: <a href="https://www.datatables.net/examples/api/multi_filter_select.html" rel="nofollow noreferrer">Individual column searching (select inputs)</a>.</p>
  <p>This also works up to the moment when I try to use UIHints to style my output. I think the problem is that my javascript code looks for the old cell content, while the actual cell content has already been changed by my UIHint. What is the best way to make my Drowpdown Filter working anyways?</p>
  <p>Thank you in advance!</p>
  <p>Here is a part of my code:</p>
  <p><strong>Status.cshtml</strong> (Display Template for status)</p>
  <pre><code>@model short?
  
  @if (Model == 0)
  {
      &lt;b&gt;Not Set&lt;/b&gt;
  }
  else if (Model == 1)
  {
      &lt;b&gt;Created&lt;/b&gt;
  }
  else if (Model == 2)
  {
      &lt;b&gt;Approved&lt;/b&gt;
  }
  else if (Model == 3)
  {
      &lt;b&gt;Done&lt;/b&gt;
  }
  </code></pre>
  <p><strong>Index.cshtml</strong> (View)</p>
  <pre><code>@model IEnumerable&lt;data&gt;
  
  &lt;h2&gt;Data&lt;/h2&gt;
  
      &lt;table class=&quot;display&quot; id=&quot;db_table&quot; style=&quot;width:100%&quot;&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;
                      @Html.DisplayNameFor(model =&gt; model.month)
                  &lt;/th&gt;
                  &lt;th&gt;
                      @Html.DisplayNameFor(model =&gt; model.year)
                  &lt;/th&gt;
                  &lt;th&gt;
                      @Html.DisplayNameFor(model =&gt; model.country)
                  &lt;/th&gt;
                  &lt;th&gt;
                      @Html.DisplayNameFor(model =&gt; model.status)
                  &lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
              @for (var i = 1; i &lt; Model.Count(); i++)
              {
                  &lt;tr&gt;
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; Model.ElementAt(i).month)
                      &lt;/td&gt;
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; Model.ElementAt(i).year)
                      &lt;/td&gt;
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; Model.ElementAt(i).country)
                      &lt;/td&gt;
                      &lt;td&gt;
                          @Html.DisplayFor(modelItem =&gt; Model.ElementAt(i).status)
                      &lt;/td&gt;
                  &lt;/tr&gt;
              }
          &lt;/tbody&gt;
      &lt;/table&gt;
      
      @section scripts
      {
          &lt;script src=&quot;~/Scripts/Custom/datatable.js&quot;&gt;&lt;/script&gt;
      }
  </code></pre>
  <p><strong>datatable.js</strong></p>
  <pre><code>$(document).ready(function () {
  
      $('#db_table').DataTable({
          ordering: false,
          paging: false,
          lengthChange: false,
  
          initComplete: function () {
              this.api().columns(3).every(function () {
                  var column = this;
                  var select = $('&lt;select&gt;&lt;option value=&quot;&quot;&gt;&lt;/option&gt;&lt;/select&gt;')
                      .appendTo($(column.header()))
                      .on('change', function () {
                          var val = $.fn.dataTable.util.escapeRegex(
                              $(this).val()
                          );
  
                          column
                              .search(val ? '^' + val + '$' : '', true, false)
                              .draw();
                      });
  
                  column.data().unique().sort().each(function (d, j) {
                      select.append('&lt;option value=&quot;' + d + '&quot;&gt;' + d + '&lt;/option&gt;')
                  });
              });
          }
  
      });
  });
  </code></pre>