title: jQuery datatables filter row with specific class
body: <p>I am working on a jQuery Datatable project where I need to filter the data based on specific row classes.  I'm adding classes to my rows upon row creation based on a condition.  I'm trying to figure out a way for my user to click a button which would apply a filter that only displays rows that contain a specific class.  </p>
  
  <p>I've tried a few different solutions but I can't seem to make it work.  Does anyone know how to do this correctly?</p>
  
  <p>Here is the <a href="https://jsfiddle.net/austin350s10/subs65n8/1/" rel="noreferrer">JSFiddle</a>   </p>
  
  <pre><code>$('#table').DataTable({
  data: data,
  columns: [
      { 
          "data": "item1",                      
          "render": function ( data, type, row ) {
              if(type === 'display'){
                  return "&lt;span class='format1'&gt;"+data+"&lt;/span&gt;";
              }else if(type === 'sort'){
                  return data;
              }else if(type === 'filter'){
                  return data;
              }else{
                  return data;
              }
          }
      },
      { 
          "data": "item2",                      
          "render": function ( data, type, row ) {
              if(type === 'display'){
                  return "&lt;span class='format2'&gt;"+data+"&lt;/span&gt;";
              }else if(type === 'sort'){
                  return data;
              }else if(type === 'filter'){
                  return data;
              }else{
                  return data;
              }
          }
      }   
  ],
  createdRow: function ( row, data, index ) {
      if (data.item2 == 'this is item 2 - meets condition1') {
          $(row).addClass('condition1');
      }
      if (data.item2 == 'this is item 2 - meets condition2') {
          $(row).addClass('condition2');
      }
  }
  });
  
  $('#btn-filter').on('click',function(){
      //// only show table data that contains the class condition1
  });
  $('#btn-undo').on('click',function(){
      //// remove the filter that was applied with btn-filter
  });
  </code></pre>