Thanks! With that help, I was able to figure out a function that would work from the user’s side. The datatable just needs to be given an id in the Jinja template so that it can be found by the css_selector.
def datatableScrollRowIntoView(driver, css_selector, row):
data_root_id = driver.find_element(By.CSS_SELECTOR, '{} > .bk-root'.format(css_selector)).get_attribute('data-root-id')
bokeh_view_index_index = driver.execute_script(
"""
const views = Object.values(Bokeh.index)
const id = arguments[0]
for (var i = 0; i < views.length; i++) {
if (views[i].model.id == id) {
return i
}
}
""", data_root_id)
driver.execute_script(
'Object.values(Bokeh.index)[arguments[0]].grid.scrollRowIntoView(arguments[1])',
bokeh_view_index_index, row)