mwouts / itables

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

Is there a way to make colvis button work without reset_index() #298

Open sherry151 opened 1 week ago

sherry151 commented 1 week ago

I would really like to have Column visibility work for tables with index columns. Index columns allow for nice formatting using background colors and Pandas styler.

mwouts commented 1 week ago

Hi @sherry151 , there is a JavaScript example for how to do this on the datatable documentation: https://datatables.net/reference/button/colvis

You should be able to port it to ITables - use JavaScriptFunction to define the columnText function as in this example: https://mwouts.github.io/itables/formatting.html#colors-based-on-cell-values