What version of bokeh are you using? CDSView (as of 3.x I believe) no longer takes “filters” but rather a single filter (and you use IntersectionFilter/UnionFilter etc. to blend them)…
Anyway, here’s a snippet. Not using BooleanFilter because I don’t think that’s actually what you need → You want to collect the indices from src meeting a certain condition (i.e. is depth_range within the bounds of the range slider?) and then use those indices to update an IndexFilter.
from bokeh.plotting import figure, show
from bokeh.models import CustomJS, RangeSlider, CustomJS, IndexFilter, CDSView, ColumnDataSource
from bokeh.layouts import column
src = ColumnDataSource(data={'x':[[1,2,3],[1,2,3],[1,2,3]]
,'y':[[3,1,2],[2,2,1],[2,3,4]]
,'depth_range':[5,4,3]
,'c':['blue','red','green']
})
sl = RangeSlider(start=0,end=6, step=1,value=(0,6),title='depth_range')
f = figure()
#initalize filter containing ALL indices --> because starting the slider at either end of its start/end
filt = IndexFilter(indices=list(range(len(src.data['depth_range']))))
view = CDSView(filter=filt)
r = f.multi_line(xs='x',ys='y',line_color='c',source=src,view=view)
#the callback
cb = CustomJS(args=dict(src=src, sl=sl, filt=filt)
,code='''
var inds = []
//for every item in the src, if its depth range value lies within the slider bounds, append it to the inds list
for (var i = 0; i<src.data['depth_range'].length; i++){
if (src.data['depth_range'][i] >= sl.value[0] && src.data['depth_range'][i] <= sl.value[1]){
inds.push(i)}
}
//update the filter with the new indices and emit the change to the src
filt.indices = inds
src.change.emit()
''')
#want this code to trigger when value of slider changes
sl.js_on_change('value',cb)
show(column([f,sl]))