我有两个问题。我正在尝试使用ListView
创建一个crud。 Now here's how I want my UI to look
我使用以下代码创建了它:
var studentManagementListView: ListView = ListView {
items: ["bla", "bla", "bla", "bla", "bla", "bla", "bla", "bla", "bla", "bla", "bla"]
cellFactory: function() {
def listCell: ListCell = ListCell {
node: HBox {
spacing: 10
content: [
Label {
text: bind if (listCell.empty) then "" else "{listCell.item}"
visible: bind not listCell.selected and not listCell.empty
}
TextBox {
text: bind listCell.item.toString()
columns: 12
visible: bind listCell.selected and not listCell.empty
selectOnFocus: true
}
SwingComboBox {
visible: bind listCell.selected and not listCell.empty
items: for (classItem in classes) {
SwingComboBoxItem {
selected: false
text: classItem.toString()
value: classItem
}
}
}
Button {
text: "delete"
visible: bind listCell.selected and not listCell.empty
action: function() {
}
}
Button {
text: "save"
visible: bind listCell.selected and not listCell.empty
action: function() {
}
}
]
}
}
}
};
现在我遇到了麻烦。
SwingComboBox
表现得非常奇怪,只有在新选择ListCell
时才会打开。选择SwingComboBoxItem
。ComboBox
)?我尝试在ListView
之外定义ListCell,并且通常定义ListView
之外的所有内容,以便我可以轻松地使用所有内容,但我得到一些错误,说某些内容已经定义。基本上对于第二个问题,我只想知道如何以不同的方式填充ListView
然后我现在正在做。
我还没有在谷歌机器上找到任何有用的东西。如果有人可以提供帮助,我会很感激!