I’m trying to add hyperlink that is derived from two or more cells of the same row.
I could add hyperlink with
cellRenderer=JsCode(
"""function(params) {return `<a href="https://www.google.com" target="_blank">${params.value}</a>`}"""
)
But this only passes cell value, is there a way to read contents of the row in JsCode?
Cheeres
Found a solution that works,
gb.configure_column(
"apple",
type=["numericColumn", "numberColumnFilter", "customNumericFormat"],
precision=2,
aggFunc="sum",
cellRenderer=JsCode(
"""function(params) { return `<a href="https://www.google.com" target="_blank">${params.value.a} ${params.value.b}</a>`}"""
),
valueGetter=JsCode("""function(params) {return {a: params.data.apple, b: params.data.banana} }"""),
)
In above code valueGetter
is used to collect two values from a row and renderer can use it.