Custom copy function in new buttons extension (fnSetText?)

Custom copy function in new buttons extension (fnSetText?)

penguinatorpenguinator Posts: 2Questions: 1Answers: 0

I have an application that relies heavily on TableTools. In a few cases, there are custom buttons where strings are generated and copied to the clipboard using the TableTools fnSetText() function.

I have mapped pretty much every other feature I need to the buttons API except fnSetText. Is there anything similar I can use? My code would get very messy if I tried to do this with the render function, and not sure that would even be possible given the types of output I'm generating.

Thanks

Answers

  • penguinatorpenguinator Posts: 2Questions: 1Answers: 0

    After looking through the code for the extensions, it would appear that there's no officially supported way to do this.

    For now, I'm using:
    config._flash.setText(output);
    dt.buttons.info(
    dt.i18n('buttons.copyTitle', 'Copy to clipboard'),
    dt.i18n('buttons.copyInfo', {
    _: 'Copied %d rows to clipboard',
    1: 'Copied 1 row to clipboard'
    }, i),3000);

    This of course has its drawbacks and only works with the flash extension. Would be great to see some methods built in to handle custom output, but this will work for now.

This discussion has been closed.