To be honest, this problem gave me a hard time...
But, you could redesign the tables a bit to get around it.
You have this "master" table with two rows. The first row contains the headers and the second row contains a bunch of <div>-tags.
The <div>-tags can be hidden or shown at any time so they are the perfect place to put your original tables in, without the headers of course...
Then just make a small script for each one of the buttons so they set the properties of the div-tags correctly...