Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hyperlinks in column cells stopped working recently #119

Closed
dajavous opened this issue Jul 31, 2022 · 8 comments
Closed

Hyperlinks in column cells stopped working recently #119

dajavous opened this issue Jul 31, 2022 · 8 comments

Comments

@dajavous
Copy link

dajavous commented Jul 31, 2022

I have been successfully using this very useful package, and until recently could implement hyperlinks in a column with the code:

gb.configure_column("ISSUE", headerName="ISSUE", cellRenderer=JsCode('''function(params) {return '<a href="https://thebcd.co.uk/issue_' + params.value + '" target="_blank">'+ params.value+'</a>'}'''), width=300)

which would result in a hyperlink to an address related to the cell value.

On editing a different part of of my app, I now find that instead of creating a hyperlink to the address, the html text is written to the screen instead:

<a href="https://thebcd.co.uk/issue_1" target="_blank">1</a>

rather than the hyperlink 1 to the address. Any help appreciated.

@PablocFonseca
Copy link
Owner

I'm checking this issue, please use the previous version meanwhile

@PablocFonseca
Copy link
Owner

Should be working in 0.3.2

I had to downgrade ah-grid-react to 6.2.0

@dajavous
Copy link
Author

dajavous commented Aug 2, 2022 via email

@rafaela00castro
Copy link

I'm using the new version (0.3.2), but the link still doesn't work. @dajavous did you do something different?
I can't use the previous version (0.2.3.post2) because in this version the nested grid isn't working.

image

@dajavous
Copy link
Author

dajavous commented Aug 4, 2022

The full app listings (app.py and short.py) are in my public repository at https://github.com/dajavous/thebcd-public, with the apps at https://dajavous-thebcd-public-short-yihtck.streamlitapp.com/ and https://dajavous-thebcd-public-app-ztufun.streamlitapp.com/ - please note that only the hyperlink to issue 1 will work, as the real links in my private repository apps point to a separate paid membership site (so would result in a 404 message) - issue 1 is a dummy link to an existing page on a public site.

@rafaela00castro
Copy link

Thanks @dajavous for your reply. And links are working fine in the first grid, but I didn't have the same luck when I tried to add in the second grid (using nested grid).

@PablocFonseca do you have any workaround for that?

image

Code extracted from here.

    # provide Detail Cell Renderer Params
    "detailCellRendererParams": {
        # provide the Grid Options to use on the Detail Grid
        "detailGridOptions": {
            "rowSelection": "multiple",
            "suppressRowClickSelection": True,
            "enableRangeSelection": True,
            "pagination": True,
            "paginationAutoPageSize": True,
            "columnDefs": [
                {
                    "field": "callId", 
                    "cellRenderer": JsCode('''function(params) {return '<a href="https://www.google.com" target="_blank">' + params.data.callRecords.callId +'</a>'}'''),
                },
                {"field": "direction"},
                {"field": "number", "minWidth": 150},
                {"field": "duration", "valueFormatter": "x.toLocaleString() + 's'"},
                {"field": "switchCode", "minWidth": 150},
            ],
            "defaultColDef": {
                "sortable": True,
                "flex": 1,
            },
        },
        # get the rows for each Detail Grid
        "getDetailRowData": JsCode(
            """function (params) {
                console.log(params);
                params.successCallback(params.data.callRecords);
    }"""
        ).js_code,
    },

@dajavous
Copy link
Author

dajavous commented Aug 6, 2022

Replacing the cellRenderer parameter with params.value works. See the code at:

https://github.com/dajavous/thebcd-public/blob/main/nestedgrids.py

and the app at:

https://dajavous-thebcd-public-nestedgrids-n11jj7.streamlitapp.com/

@rafaela00castro
Copy link

@dajavaus , thank you very much for your help. It's working, after I followed your kind instructions!!
Now I can see what my problem was :)

@dajavous dajavous closed this as completed Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants