在TableView的一个单元格中添加带有文本字段的按钮

时间:2019-03-15 08:33:59

标签: tornadofx

在此列中,我使用文本字段进行编辑,我想在同一单元格中添加一个带有文本字段的按钮,以打开搜索窗口

column("code", StockMoveLine::itemCode).useTextField {
                        button("search"){
                            action {
                                lineStockItem.item = StockItem()
                                lineStockItem.isItemSelected = false
                                lineStockItem.internalView = false
                                val viewScope = Scope()
                                lineStockItem.internalView = true
                                setInScope(lineStockItem, viewScope)
                                println("--------------------------------------")
                                openInternalWindow<StockItemList>(viewScope)
                                lineStockItem.isItemSelectedProperty.onChange {
                                    selectionModel.selectedItemProperty().value.stockItem = lineStockItem.item
                                    selectionModel.selectedItemProperty().value.itemCode = lineStockItem.item.code
                                    this@tableview.refresh()
                                }
                            }
                        }
                        runAsync {

                            var finded = stockItems.find { it ->
                                it.code.equals(selectionModel.selectedItemProperty().value.itemCode)
                            }
                            if (finded != null) {
                                selectionModel.selectedItemProperty().value.stockItem = finded
                            }
                        }
                    }

0 个答案:

没有答案