Currently, I am using one tabulator widget to display multiple data in different databases, and I want to use the on_click event to have a FloatPanel appear and show the data more in depth.
It is working, but occasionally, it give an error like this one.
ERROR:bokeh.server.protocol_handler:error handling message
message: Message 'PATCH-DOC' content: {'events': [{'kind': 'MessageSent', 'msg_type': 'bokeh_event', 'msg_data': {'type': 'event', 'name': 'cell-click', 'values': {'type': 'map', 'entries': [['model', {'id': 'p1097'}], ['column', 'Creation Date'], ['row', 1]]}}}]}
error: ValueError('The Tabulator widget expects the provided `value` Pandas DataFrame to have unique indexes, in particular when it has to deal with click or edit events. Found this duplicate index: 1')
Here are the code that I configured
tabulator_widget = None
def show_row_content(event):
if tabulator_widget is None:
return
row = event.row
row_data = tabulator_widget.value.iloc[int(row)]
float_panel = pn.layout.FloatPanel(row_data) #Doesnt matter the content
self._main.append(float_panel) #append it to the UI for view
tabulator_widget = pn.widgets.Tabulator(
pagination="local",
page_size=10,
disabled=True,
value=get_df(database=None), #There will be a button below to change the value of this Tabulator
on_click=show_row_content,
theme="bootstrap4",
sizing_mode="stretch_width",
configuration={
"paginationSizeSelector": True,
}
)