I have a dataframe with hyperlinks that I am rendering using st_aggrid. I am using the cellRenderer method to render the link column like so
jsCodeLink = JsCode("""function(params) {return <a href="${params.value}" target="_blank"> Source Link </a>}""")
and subsequently attaching the cellRenderer to the column like so
builder.configure_column("Hyperlink",
headerName="Link",
cellRenderer= jsCodeLink,
width=100)
The issue is it works perfectly when deployed on windows server but not on linux. My main server is in linux and all dataframes with links are messed up due to this.
The link does not get decoded properly by the browser. This only happens in the case of linux server.
I have tried the following:
- I tired to write a replace function in JsCode but that did not work.
jsCodeLink = JsCode("""
function(params) {
output = <a href="${params.value}" target="_blank"> Source Link </a>;
var entities= {
"&": "&",
"<": "<",
">": ">"
//....
};
for (var prop in entities) {
if (entities.hasOwnProperty(prop)) {
output = output.replace(new RegExp(prop, "g"), entities[prop]);
};
};
return output;
}
""")
- I set the streamlit markdown on initialisation. No luck.
st.markdown("<meta charset='UTF-8'>", unsafe_allow_html=True)
- Forced changed Linux server encoding to UTF-8. No luck either
Spent whole day trying to fix this. Must be something simple silly fix. Any help would be greatly appreciated.
Thanks!
Any one with a potential solution?