Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

thead is deleted from resulting table after calling destroy when Absolute Positioning is off and the table was initialized while hidden #127

Closed
MrStonedOne opened this issue Oct 12, 2014 · 6 comments
Labels

Comments

@MrStonedOne
Copy link

What it says on the tin. When you call destroy on a table that has absolute positioning turned off and table was initialized while hidden, it will lose it thead. As in, the actual thead object/node no longer exists in the dom.

Version v1.2.9-0-g997917e

Note: im using bootstrap 3 and some of my tables are in collapsing panels, so i have a bit of code to make thead play nice with that.

Almost all pages have mutiple tables, so that may play a part.

This worked fine until i tried turning off absolute positioning to make it play nice with chrome.

here is all code for initializing and destroying floatthead (this is in the sites global js file)

//float the thead of all tables with class floatthead
$('table.floatthead').floatThead({
        useAbsolutePositioning : false
    }
);

//fixes floatthead in collapsing panels

//remove floatthead from all panels
$('.panel-collapse table.floatthead').floatThead('destroy');
//re-add it to all panels that are visible
$('.panel-collapse.in table.floatthead').floatThead({
        useAbsolutePositioning : false
});

//adds/removes floatingthead when table is being hidden/shown
$('.panel-collapse').on('hide.bs.collapse', function () {
    $(this).find('table.floatthead').floatThead('destroy');
});

$('.panel-collapse').on('shown.bs.collapse', function () {
    $(this).find('table.floatthead').delay(1000).floatThead({
            useAbsolutePositioning : false
    });
    $('table.floatthead').floatThead('reflow'); //reflow all tables because vertical positioning has changed
});

Note:This code, with the useAbsolutePositioning : false part removed, works fine.

@MrStonedOne MrStonedOne changed the title thead is deleted from resulting table after calling destroy when Absolute Positioning is off thead is deleted from resulting table after calling destroy when Absolute Positioning is off and the table is hidden Oct 12, 2014
@mkoryak
Copy link
Owner

mkoryak commented Oct 13, 2014

any chance for a jsfiddle?

@MrStonedOne
Copy link
Author

I figured it out better while making that jsfiddle. and will update the issue after posting this comment.

http://jsfiddle.net/9oseyjg9/

steps to reproduce: hide table, float thead abs=off, show table (optional, can be done at the end), unfloat thead.

Tested in firefox 32.0.3

Basically destroying a fixed pos table that was initialized while the table was not visible deletes the thead.

Initializing a table while it is not visible has its own set of issues, but none that can't be solved by reflowing or refloating the table.

The only reason i still consider this a bug worthy of reporting is because it deletes the thead node.

@MrStonedOne MrStonedOne changed the title thead is deleted from resulting table after calling destroy when Absolute Positioning is off and the table is hidden thead is deleted from resulting table after calling destroy when Absolute Positioning is off and the table was initialized while hidden Oct 13, 2014
mkoryak added a commit that referenced this issue Oct 15, 2014
@mkoryak
Copy link
Owner

mkoryak commented Oct 15, 2014

Thanks, Ive needed to address the weirdness that happens when the table is hidden for a while now. This jsfiddle gives me a good starting point.

mkoryak added a commit that referenced this issue Oct 16, 2014
made hidden table handling better - if the table is hidden when floatThead is called, its not so bad now.
@mkoryak
Copy link
Owner

mkoryak commented Oct 16, 2014

I have a fix on my doc site - havent pushed it up to master yet. You can check it out:

http://mkoryak.github.io/floatThead/tests/issue-127/

Thanks for finding this, I couldn't have stumbled on it unless I was stoned.

@mkoryak mkoryak added the bug label Oct 16, 2014
@mkoryak
Copy link
Owner

mkoryak commented Oct 21, 2014

Hey, this is now fixed on master.

@mkoryak mkoryak closed this as completed Oct 21, 2014
@lock
Copy link

lock bot commented Dec 11, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Dec 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants