Dataframe: give name to column which is triggered by selection

Hi,

my question is in the context of this issue:

I use this work around, but I could not figure out how to give a name to the column which holds the check box. Is there a way to make this possible? Otherwise it is very hidden and not obvious.

Thanks

I dont know if I fully follow your question, but I basically display lets say 5 columns of my table, where 5th is โ€œShow Detailsโ€ and thats a check box, when you click the box then a panel underneath gets displayed with the rest of the info - Im not sure if youre asking about the code or just the concept

Hi,
it all works perfectly fine. The only thing I would like to achieve is having a name for the checkbox column. Currently the name of the column is empty.
Screenshot 2024-07-05 at 15.25.11
The left column in the screen shot is my checkbox column. But there is no title for this column, like the next column called โ€˜IDโ€™?

:point_up:I used the code from Multiple links in one dataframe field - #9 by edsaac

ok, I see what youre saying - this is because th right panel is created by :

selection = st.dataframe(
            df,
            use_container_width=True,
            column_config={"link_list": None},
            hide_index=True,
            selection_mode="single-row",
            on_select="rerun",
        )

the explanation of how that works with dataframe is here: st.dataframe - Streamlit Docs

in your case I would use data.editor (st.data_editor - Streamlit Docs) and in column.config you can choose which column you want to use as a check box and declare as such in config_column (then you can name it whatever)
like in this example they have in documentation:

import pandas as pd
import streamlit as st

data_df = pd.DataFrame(
    {
        "widgets": ["st.selectbox", "st.number_input", "st.text_area", "st.button"],
        "favorite": [True, False, False, True],
    }
)

st.data_editor(
    data_df,
    column_config={
        "favorite": st.column_config.CheckboxColumn(
            "Your favorite?",
            help="Select your **favorite** widgets",
            default=False,
        )
    },
    disabled=["widgets"],
    hide_index=True,
)

Hi, thanks for your reply. But I am sorry, I simply do not understand it. The code you posted gives me a checkbox column but I do not see a way to solve my initial problem. In your first reply(Dataframe: give name to column which is triggered by selection - #2 by mj907) you described it correct.

In the end, my problem is that I have more than 10 links per row and I do not know how to show this in a nice way. Therefore, the idea of having a modal window is great. And selecting a row and showing the right links depending on the selection works perfectly fine. My users just do not know that they can do it, as the column header is empty.