jquery-thead icon indicating copy to clipboard operation
jquery-thead copied to clipboard

Puts an extra table with thead on the page

Open jasonperrone opened this issue 8 years ago • 3 comments

Hi there. I'm looking at the code and it's pretty much doing on my page exactly what the code says and it doesn't seem right. I have a table with a thead, tbody and tfoot in it. The class of the table was set to jquery-thead. And as the code explicitly does in $.fn.thead, it clones that table with its thead into a new table and adds it to the page. Now I have this weird artifact underneath my table, which is in fact a new table with a new thead. I don't get it. Why does it do this? I need to get rid of this artifact on my page.

jasonperrone avatar May 11 '17 14:05 jasonperrone

I see what is happening. You do set the new table to display: none, but I have it nestled in a container which does display. It would be easy to hide the cloned container if you put a class on it. The code says you are putting a class of cloned_thead on it, but it doesn't appear to be working. The container you added the table to does not in fact have that class.

jasonperrone avatar May 11 '17 14:05 jasonperrone

I believe I see why the class is not there. Right after you add cloned_thead as a class on the new container, you then use the attr() method to set the new containers classes to the parent's classes, and this deletes the cloned_thead class you just added.

jasonperrone avatar May 11 '17 14:05 jasonperrone

I fixed the problem by merely adding the cloned_thead class after you set the new container's classes to the parent's classes. Unfortunately, if in my css I set the cloned_thead to display: none, it breaks the plugin.

jasonperrone avatar May 11 '17 15:05 jasonperrone