https://kotlinlang.org logo
p

pike

11/28/2018, 6:07 AM
but I'm using it in two different places, both models on the table extend a "CsvJsonModel" that generates the correct strings for the header and rows... however if I try to write a function like this:
Copy code
fun copyTableToClipboard(dataTable: TableView<CsvJsonModel>) {
    val clipboard = Clipboard.getSystemClipboard()
    val content = ClipboardContent()
    var copyString = dataTable.items[0].propsToCsv()
    copyString += dataTable.items.joinToString("\n") {rowItem ->
        rowItem.toCsv()
    }
    content.putString(copyString)
    clipboard.setContent(content)
}