Filter pivot tables directly by totals or aggregated values

Quick code to add filter by totals/ aggregated values functionality to pivot tables.

Javascript

/* Hide Rows with visiotr IDs =1 */
['component_21', 'component_22', 'component_23', 'component_24', 'component_25',].forEach(function(componentId) {
  TB.render(componentId, function(data) {
    var $ = jQuery;
    $('.t-pivot-table-row').each(function() {
      var secondVal = parseFloat($(this).find('td:nth-child(2) span').text());
      if (!isNaN(secondVal) && secondVal <= 1) $(this).hide();
    });
  });
}); 

CSS (Helpful if you are using the side widgit and only a few records)

tr {
  height: 20px;
  transition: height 0.3s ease;
  overflow: hidden;
}

.opened {
  height: 300px;
}