mwouts / itables

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

SearchBuilder picks up &nbsp as column name for Pandas styler object but works fine for Pandas dataframe object #297

Closed sherry151 closed 2 months ago

sherry151 commented 3 months ago
    from itables import init_notebook_mode
    import itables.options as it_opt
    init_notebook_mode(all_interactive=True)
    it_opt.paging = False
    it_opt.scrollY = "50vh"
    it_opt.scrollCollapse = True
    it_opt.scrollX = True
    it_opt.keys = True
    it_opt.select = True
    it_opt.buttons =   ["csvHtml5", "excelHtml5",
                        {
                           "extend": "colvis",
                           "collectionLayout": "fixed columns",
                           "popoverTitle": "Column visibility control"
                        }
                    ]
    it_opt.layout={"top1": "searchBuilder", "topEnd": None}
    it_opt.column_filters="footer"

This works fine with a DataFrame object even when the dataframe has a multiindex. But it does not work with a styler object for the same multiindex dataframe

DataFrame

image

Styler

image
mwouts commented 3 months ago

I guess you will have to set custom names for your columns using https://datatables.net/reference/option/columns.searchBuilderTitle

sherry151 commented 2 months ago

This worked beautifully. Thank you.