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

no space outside of table causes it to always float (cover first rows) #180

Closed
fiendish opened this issue Apr 1, 2015 · 14 comments
Closed
Labels

Comments

@fiendish
Copy link

fiendish commented Apr 1, 2015

If there are no pixels (body margin:0px, padding:0px, etc) between the top of the page and the table, setting the table to windowscroll always triggers the floating condition which means the first row(s) are always partially hidden.

I fixed this for my case (window scroll, absolute) by simply changing the > to >= in line

} else if (tableOffset.top > windowTop + scrollingTop) {

I'm going to guess that the arithmetic is similar for other scrollings.

@mkoryak
Copy link
Owner

mkoryak commented Apr 2, 2015

Thanks for finding the fix. Do you mind throwing up a jsfiddle that demonstrates this bug so I can have something to test against?

@fiendish
Copy link
Author

fiendish commented Apr 2, 2015

http://jsfiddle.net/9eo8gjag/

Change the body css from margin 0 to margin 1.

There exists a second obvious problem in the posted fiddle, however. Even after changing the margin to 1, scrolling at all completely breaks the arrangement.

@mkoryak
Copy link
Owner

mkoryak commented Apr 2, 2015

I see your clever trick to get around the error you would get when you run this plugin on a table which does not have a thead. this is what causes it to fail on reflow, see update:

http://jsfiddle.net/9eo8gjag/1/

I see the bug that you outlined, thanks. Ill have a fix soon

@mkoryak mkoryak added the bug label Apr 2, 2015
@fiendish
Copy link
Author

fiendish commented Apr 2, 2015

I had a thead, but you are right I accidentally did not have a tbody tag! (oops. that is a mistake that is not present in my project though).
Updated.

http://jsfiddle.net/9eo8gjag/2/

Is it thus necessary to have a tbody defined before calling floatThead?
Compare
http://jsfiddle.net/9eo8gjag/3/

Version 3 looks good. Version 2 is as I was using it in my project (call to floatThead first, then populate later with data as data arrives, then call to reflow). It seems that just defining the empty tbody before calling floatThead initially makes everything work.

@fiendish
Copy link
Author

fiendish commented Apr 2, 2015

Oops. Actually update 2 is not what I meant to show. I'm doing a terrible job of cutting down the one I have from before...hold on...

@fiendish
Copy link
Author

fiendish commented Apr 2, 2015

Here. (finally, I think?)
Compare http://jsfiddle.net/9eo8gjag/4/ with http://jsfiddle.net/9eo8gjag/3/

@mkoryak
Copy link
Owner

mkoryak commented Apr 2, 2015

yep, that looks like a bug to me. Ill get a fix in for it soon
tbody is not required, but once you add one you will need to reflow (or maybe not, you should check )

@fiendish
Copy link
Author

fiendish commented Apr 2, 2015

Reflow after adding tbody doesn't seem to help.
http://jsfiddle.net/9eo8gjag/5/

(I notice I set margin to 1 in the /4 update. I guess make sure to set it to 0 when comparing)

@mkoryak
Copy link
Owner

mkoryak commented Apr 2, 2015

nice, i see a different bug here that ive been trying to fix for a while but didnt have a good way to reproduce: http://jsfiddle.net/9eo8gjag/6/

thanks for the reports.

mkoryak added a commit that referenced this issue Apr 2, 2015
@fiendish
Copy link
Author

fiendish commented Apr 2, 2015

Sorry if this is abusing the issue queue, but is your other bug the different scrolling behavior where the tbody jumps when you start scrolling if it's not created before the first floatThead and scrolls smoothly if declared before?
( scrolling behavior http://jsfiddle.net/9eo8gjag/7/ vs http://jsfiddle.net/9eo8gjag/6/ )
I can make a new issue if you want. I know the thread is diverging.

@mkoryak
Copy link
Owner

mkoryak commented Apr 2, 2015

my other bug is that floatThead does not init itself properly after you add the body. remove the plugin code and you will see that the table should be much wider after you stick that html into it.

@mkoryak
Copy link
Owner

mkoryak commented Apr 3, 2015

Heh, you are in sommerville, I am in JP. small world :)

your original issue should be fixed on master. I made the change you suggested.

I just noticed the scrolling/jumping bug you pointed out. I think you are the first person add a tbody after plugin init, but I think its a valid usecase and should work. If you want to make a new issue that would be great.

I will probably make a 3rd issue for myself with the size thing, but that one is going to be hard to fix.

@mkoryak
Copy link
Owner

mkoryak commented Apr 9, 2015

I moved both bugs into #186 because they turned out to be related. closing this

@mkoryak mkoryak closed this as completed Apr 9, 2015
@lock
Copy link

lock bot commented Dec 10, 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 10, 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