我有两个bokeh表,我想单击第一个表中的表记录,并根据字段中的匹配值在第二个表中选择行。创建了一个js回调脚本来:
创建一个空列表来保存来自table2的与表1中的记录匹配的索引 收集到表1的选定索引中
遍历表1中的索引并收集值以与表2进行比较 循环遍历表2并在表ID匹配的情况下附加索引。
运行脚本并在表上选择时什么也没有发生。
code = """
var select_indices = []
var cdata = cb_obj.data;
var pdata = psrc.data;
var indices = cb_obj.selected.indices;
for (var i=0; i < indicies.length; i ++){
var hh_id = cdata['hh_id'][i]
for (var j = 0; j < pdata['hh_id'].length; j++){
if(pdata['hh_id'][j] == hh_id){
select_indices.push(j)
}
}
}
psrc.selected.indices = select_indices;
psrc.trigger('change');
"""
hh_src.callback = CustomJS(args=dict(psrc=per_src), code=code)
控制台窗口错误
VM544 bokeh-0.13.0.min.js:31 Uncaught Error: not connected so cannot send
[object Object]
at t.send (VM78 bokeh-0.13.0.min.js:31)
at t._document_changed (VM78 bokeh-0.13.0.min.js:31)
at _document_listener (VM78 bokeh-0.13.0.min.js:31)
at P._trigger_on_change (VM78 bokeh-0.13.0.min.js:31)
at P._notify_change (VM78 bokeh-0.13.0.min.js:31)
at t.u._tell_document_about_change (VM78 bokeh-0.13.0.min.js:31)
at t.u.setv (VM78 bokeh-0.13.0.min.js:31)
at t.set [as indices] (VM78 bokeh-0.13.0.min.js:31)
at SlickGrid.<anonymous> (VM80 bokeh-tables-0.13.0.min.js:31)
at Event.notify (VM80 bokeh-tables-0.13.0.min.js:68)
t.send @ VM544 bokeh-0.13.0.min.js:31
t._document_changed @ VM544 bokeh-0.13.0.min.js:31
_document_listener @ VM544 bokeh-0.13.0.min.js:31
P._trigger_on_change @ VM544 bokeh-0.13.0.min.js:31
P._notify_change @ VM544 bokeh-0.13.0.min.js:31
u._tell_document_about_change @ VM544 bokeh-0.13.0.min.js:31
u.setv @ VM544 bokeh-0.13.0.min.js:31
set @ VM544 bokeh-0.13.0.min.js:31
(anonymous) @ VM546 bokeh-tables-0.13.0.min.js:31
Event.notify @ VM546 bokeh-tables-0.13.0.min.js:68
trigger @ VM546 bokeh-tables-0.13.0.min.js:86
handleSelectedRangesChanged @ VM546 bokeh-tables-0.13.0.min.js:86
Event.notify @ VM546 bokeh-tables-0.13.0.min.js:68
f @ VM546 bokeh-tables-0.13.0.min.js:68
h @ VM546 bokeh-tables-0.13.0.min.js:68
(anonymous) @ VM546 bokeh-tables-0.13.0.min.js:68
Event.notify @ VM546 bokeh-tables-0.13.0.min.js:68
trigger @ VM546 bokeh-tables-0.13.0.min.js:86
setActiveCellInternal @ VM546 bokeh-tables-0.13.0.min.js:86
handleClick @ VM546 bokeh-tables-0.13.0.min.js:86
dispatch @ jquery.min.js:2
h.dispatch @ VM85 bokeh-tables-0.13.0.min.js:62
y.handle @ jquery.min.js:2