mwouts / itables

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

Cell vertical alignment example #173

Closed avivajpeyi closed 1 year ago

avivajpeyi commented 1 year ago

Hi

Do you have any suggestions/examples on how to configure vertical alignment for cell data?

Seems like the default might be middle alignment?

https://cjhaster.com/NRSurrogateCatalog/events/gw_menu_page.html

Screenshot_20230327-201354.png

mwouts commented 1 year ago

Hi @avivajpeyi , well maybe you could use this: https://datatables.net/forums/discussion/35586/aligning-cell-contents-vertically

You might have to use the same setting for all the tables within a given notebook, cf. https://mwouts.github.io/itables/custom_css.html

In case you were looking for left/right alignment (but I think that's not your question), the instructions are here: https://mwouts.github.io/itables/advanced_parameters.html#cell-alignment

avivajpeyi commented 1 year ago

perfect, thanks!! :D

Adding the following worked:


opt.css = """
.itables table.dataTable tbody td {
  vertical-align: top;
}
"""
mwouts commented 1 year ago

Ok great! Thank you for letting us know. By the way maybe you would like to append this additional css to the default one, I mean maybe something like opt.css = opt.css + """....""" would be even better, e.g.

opt.css = opt.css + """
.itables table.dataTable tbody td {
  vertical-align: top;
}
"""
avivajpeyi commented 1 year ago

D'oh! hadnt thought of that -- your suggestion works out better, thanks!