Table row clicker

I need to create a flow where a user clicks on a table row and a new page opens with some details.
I have reviewed several posts how it is implemented, but still no good clear solution.
Please assist.

Flow:

  1. Page 1 displays a table with rows. User clicks on a row we retrieve ID
  2. Next page opens with some information retrieving it from ID

Hi,
Maybe this start will help you, you could introduce a st.dialog later.

if "event" not in st.session_state:
    st.session_state.event = userMaster.get_eventos()

if "selected_id" not in st.session_state:
    st.session_state.selected_id = None

def generate_dataframe_and_event():
    input_text = st.text_input("Filtrar:", key="_input")
    output_data = search_data(input_text, st.session_state.event).reset_index(drop=False)
    event = st.dataframe(
        output_data,
        key="data",
        on_select="rerun",
        selection_mode=["single-row"],
    )
    # Seleccionar la primera fila por defecto
    if not event.selection:
        event.selection = {"rows": [0], "columns": []}

    selection = event.selection
    if selection:
        selected_rows = selection["rows"]
        selected_cols = selection["columns"]
        if selected_rows:  # Verificar que selected_rows no esté vacío
            original_index = output_data.loc[selected_rows, 'index'].values[0]
            selected_df = st.session_state.event.loc[[original_index]]
            if not selected_df.empty:
                st.session_state.selected_id = int(selected_df['proyecto_id'].iloc[0])
            else:
                st.warning("No se ha seleccionado ninguna fila")
        else:
            st.warning("No se ha seleccionado ninguna fila")

        # Display 
        #st.write("Evento Seleccionado:")
        #st.write(st.session_state.df.loc[[original_index]])
        return st.session_state.event
    else:
        return st.session_state.event

generate_dataframe_and_event()

@Oscar Thanks for helping out. So you get the id of the row from the session state, correct?

Yes, If a row is selected, it retrieves the original index of the selected row and uses it to get the corresponding project ID from the st.session_state.event dataframe.
Stores the selected project ID in the st.session_state.selected_id variable.