python - Bokeh TableData on_change selected event called twice -
i have bokeh ui select, datatable , button.
- select allows go directly given line in datatable
- button allows go next line in datatable
- datatable allows direct single line selection (hence updates select).
datatable keeps tracking on selection change event through:
self.__table_data.on_change('selected',self.table_selection_change)
when button clicked, change selected attribute of datatable source new dict structure seen here:
self.__table_data.selected = {'2d': {'indices': []}, '1d': {'indices': [my_new_index]}, '0d': {'indices': [], 'glyph': none}}
problem is, when did update, callback (table_selection_change) called twice while expect 1 call.
problem whole dict should not updated. relevant keys must updated.
replacing
self.__table_data.selected = {'2d': {'indices': []}, '1d': {'indices': [my_new_index]}, '0d': {'indices': [], 'glyph': none}}
by
self.__table_data.selected['1d'] = {'indices':[my_new_index]}
solves problem.
Comments
Post a Comment