mwouts / itables

Pandas DataFrames as Interactive DataTables
https://mwouts.github.io/itables/
MIT License
803 stars 58 forks source link

Jupyter Notebook 7 + itables → unreadable table #312

Closed MichalRIcar closed 2 months ago

MichalRIcar commented 2 months ago

Hello,

I am using itables 2.1.4 in JN 7.2.1 and when output is generated it occasionally "destroys" itables view.
It happens only if I am not "watching" the generated output (say I am at the top of JN and output is being generated below my screen view).

I suspect that issue might be rather on JN side, but posting here first as it happens mainly to itables. Although plotly is affected by some shrinkage too - when not watching output directly and rather scroll there after it was generated, plotly graph is shrinked (but it can be fixed by clicking on Autoscale on plotly graph).

Please let me know how I can support the issue with more data, views or video or anything which makes the cause more clear.

image

mwouts commented 2 months ago

Hi @MichalRIcar , thank you for reporting this!

Yes I am interested in knowing a bit more about this. I gave it a quick try, opening the sample_dataframes.md notebook in Jupyter Notebook (7.0.8) and I made sure the tables were creating without being visible, but so far I could not reproduce the issue on my end.

@AllanJard would you have an idea of what might cause the table to look like the screenshot above? Thanks!

AllanJard commented 2 months ago

That's fairly catastrophic isn't it! Almost certainly a CSS issue that a test case would be needed for to be able to inspect the CSS.

I could get something a little like that with some dodgy CSS.

mwouts commented 2 months ago

Thank you @AllanJard for the hint! I know what to look for now, thanks!

@MichalRIcar I have the following questions for you:

MichalRIcar commented 2 months ago

Hello, thank you for a quick response!

I've noticed that one of itables is consistently shown in the unreadble form (on the picture above) and started digging into it. I believe, I've found the reason - it is simple as removing param: style="float:left"

the quick "fix" from: show(mytable, style="float:left") to: show(mytable)

When "style="float:left"" is removed I can't reproduce the misbehavior.

mwouts commented 2 months ago

Thanks @MichalRIcar for the additional info! The default value of the style option is table-layout:auto;width:auto;margin:auto;caption-side:bottom, you might want to keep the other values.

See also https://github.com/mwouts/itables/blob/main/src/itables/options.py#L25-L34

and https://mwouts.github.io/itables/custom_css.html#position-and-width