I ran into a similar problem. First I'll describe what I was trying to do, and then at bottom I'll describe how I solved it.
Intended Outcome
I have a page that contains 5 Views, each of which are Lists/Tables. Each List displays a specific data type, all of which have a field called "Status", which is set to either "New" or "Old". Each List also has pre-set filters that allow users to view either "New" data, "Old" data, or "All" data. On pageload, the filters should be set to "New". Any Lists that do not have any data should not display. Users should also have the option to change the status of a piece of data to New or to Old.
The Problem
Like Guil and Tony, I used the prefab JS script that removes any tables that do not have results. However, because my tables are set to show "New" data first, this means that any Tables that don't have New content do not display. I dug through the Knack object in the JS console and tried to find an alternate solution, but wasn't able to find any references to the total amount of results for a table (only to the results of the table according to the current filter). Since I want the filters to initially only show "New" data, simply changing their order wouldn't solve my problem.
For what it's worth, view.attributes.menu_filters returns an array of the different filters that apply to a view, but nowhere in there is something like array[i].length that I could use to create exceptions. So I came up with a different work-around:
A Solution
First, I changed the order of my filters. Instead of displaying "New" first, and running the risk of having 0 results and a removed Table, I made the first filter "All". Then I wrote a script that, when the scene renders, selects the final filter for all filter menus on the page. I of course moved "New" over to be the final filter (which made this next bit of code easier to write).
Changing the status of data on my page to "New" or to "Old" also caused the knack-scene-render.scene_73 event listener to re-fire, which was removing my tables if I was, for example, using the "New" filter and clicked to change the status of the last piece of new data to "Old." So I also turned off the scene-render listeners for this page. They seem to re-initialize when you load a new page, so no harm no foul.
$(document).on('knack-scene-render.scene_73', function() { //run the code only when this specific scene loads
var allFilters = document.getElementsByClassName("js-filter-menu"); //find all filter menus on page
for (var i = allFilters.length - 1; i >= 0; i--) { //for each filter menu,
allFilters[i].firstChild.lastChild.firstChild.click(); //go to the list of filters, take the last filter, and click on it
}
$(document).off('knack-scene-render.scene_73'); //disable the table-removing event listener (while on this page)
});
If you use the code, don't forget to change the scene number in the first and last line to be the correct scene for your app.
I hope this is helpful! It's a bit of a work-around, and my JS certainly isn't perfectly optimized, but it does the trick for now.