Dash AG Grid - String and button in the same column?

I have a column that contains a file path and need to have a button in the same column that copies that file path string, so it can be pasted in a terminal/file manager for example (can’t open a file manager from JS afaik). Is that possible - having the Copy button in the same column as the value it needs to copy?

Thanks in advance.

Hi @maklai

Do you need a button? Have you tried enabling the text selection?

1 Like

Thanks, AnnMarrieW - lightning fast useful reply as always :slight_smile:
I have not tried. Will ask my manager - he wants me to mimic as close as possible another app (which is done using HTML, CSS, and JS) - that app has a button to make it easier for non-technical users.

Hello @maklai,

You could potentially create a custom clipboard component and use the dcc.Clipboard.

dagfuncs.Clipboard = (props) => {
    return React.createElement(window.dash_core_components.Clipboard,
        {content: props.value}
    )
}

^ this is just a guess as to what it would actually look like. :wink:

3 Likes

Thanks.

How do I find out what else I can put in the dict? If I want the contents of a certain cell, I suppose I need to set target id to the id of that cell.

Hello @maklai,

I’m not sure what you mean by this question?

The dictionary can have all the props from the dcc.Clipboard, if that is what you mean.

Yes. If I want to use a target id, the key should be target_id, not a JS version of that like targetId?

It should be whatever the react prop is asking for, which will more than likely be the same property as in the documents.

1 Like

@maklai

See an example here: