Here is the reproducible sample code which clearly shows the issues:
import numpy as np
import pandas as pd
from bokeh.models.widgets import Div
from bokeh.layouts import row, column
from bokeh.models import CustomJS, Select
from bokeh.plotting import figure, show, ColumnDataSource
cust1 = {
'industry' : 'Construction',
'biz_type' : 'Manufacturing',
'total_loan': '20,000',
'location': 'Ohio'}
cust2 = {
'industry' : 'Services',
'biz_type' : 'Plumbing Services',
'total_loan': '354,000',
'location': 'San Jose'}
def layout_single(cust):
div_leftpanel1 = Div(text = f' Customer Profile\
<br><br><i class="fa fa-file"></i> Contact Us</a> \
<br><br><i class="fa fa-file"></i> Blogs</a> \
<br><br><br><br><br> \
<p style="font-size:14px;font-family:verdana"><u>Customer Info</u> <br><br> Industry: {cust["industry"]}\
<br> Type of Business: {cust["biz_type"]} <br> Location: {cust["location"]} </p> \
<b>',
style={'width':'350px','height':'680px','border-radius': '15px',
'text-align': 'left','padding-left': '50px','font-size': '150%',
'color': 'green', 'background-color': '#91EBE8','font-family':'verdana',
'padding-top': '10px'})
banner1 = Div(text = f'<b><p style="font-size:15px;">${cust["total_loan"]}</p>\
<hr>\
Loan Amount<b>',\
style={'width':'250px','height':'90px','border-radius': '15px 15px 0px 0px',
'text-align': 'left','padding-left': '50px','padding-right': '50px',
'font-family':'verdana'})
return row([div_leftpanel1, banner1])
col = column([layout_single(cust1), layout_single(cust2)])
s = Select(value="Customer1", options=["Customer1", "Customer2"])
s.js_on_change('value', CustomJS(args=dict(s=s, col=col), code="""
for (const plot of col.children) {
plot.visible = false
}
if (s.value == "Customer1") {
col.children[0].visible = true
}
else if (s.value == "Customer2") {
col.children[1].visible = true
}
"""))
final_layout = column(s, col)
show(final_layout)