anchor.diff:            <% sub.events.each do |event| %>
               <!-- SKIP UNCANCEL SINCE MATCHING CANCEL EVENT IS NOT RETURNED AS IT WAS INVALIDED -->
               <% next if event.event_type == 'UNCANCEL' %>
  -            <tr title="<%= @bundle_names[bundle.external_key] %>">
  +            <tr title="<%= @bundle_names[bundle.external_key] %>" data-event_type="<%= event.event_type %>">
                 <td>
                   <% if event.requested_date.present? %>
                     <%= format_date(event.requested_date, @account.timezone).html_safe %>
  
positive.code:         <% else %>
            <% invoice = invoice_stub %>
          <% end %>
          <tr title="<%= bundles %>">
            <td>
              <% if invoice.invoice_date.present? %>
                <%= invoice.invoice_date %>
  
negative.code:     });
    }
  
  function filterBundles(rows) {
      var bundle = $("#bundles").val();
  
      for (i = 0; i < rows.length; i++)
      {
          tr = $(rows[i]);
          if (bundle == "" || tr.attr("title").split(",").indexOf(bundle) >= 0) {
              //first level filtering, so can remove hide
              tr.removeClass("hide");
          }
          else {
              //remove tr's not under this filter mode
              tr.addClass("hide");
          }
      }
      return rows;
  }
  
  function filterEvents(rows) {
      var event = $('#event_types').val().toUpperCase();
  
      for (i = 0; i < rows.length; i++)
      {
          tr = $(rows[i]);
          tr_data = tr.data();
          if (
              "ALL" != event || 
              tr_data.event_type != event
          ){
              //add hide to all who dont deserve to be here
              //caution: do not unhide anyone
              tr.addClass("hide");
          }
      }
  
      return rows;
  }
  
  function filterTable()
  {
      var dataTable = initTable();
      var all_nodes = dataTable.fnGetNodes();
      
      rows = filterBundles(all_nodes); //this filter should always be first
      rows = filterEvents(rows);
      //add more cascading filters here and pass rows....
      
      //my rows are filtered, draw table
      dataTable.fnDraw();
  }
  
  
  $(document).ready(function() {
      disableLinks();
      // When going through the pages of the table, disable links as needed
      $('#timeline-table').bind('draw', function (e) {
          disableLinks();
      });
  
      initTable();
  
      $("#bundles, #event_types").change(filterTable);
      filterTable();
  });
  <% end %>
  