0
(Griffon 1.2.0을 JavaFX 플러그인과 함께 사용하여) 콤보 상자의 내용을 업데이트하려고합니다.Griffon JavaFX 콤보 상자 업데이트
내 모델 :
class MyModel {
List monthList = FXCollections.observableList([new DateMidnight()])
def convertDate = [
fromString: { String s ->
return new DateMidnight(DateTimeFormat.forPattern("yyyy-MM").parseDateTime(s))
},
toString: { DateMidnight d ->
return "2011-10"
}
] as StringConverter
}
내보기에는 다음이 포함
comboBox(items: (model.monthList), converter: model.convertDate)
이제 그들은이 버튼을 누를 때 나는 호출됩니다 컨트롤러 액션이 있습니다
이def load = {
execInsideUIAsync {
def months = myService.buildMonthList()
model.monthList.addAll(months)
}
}
문제는이다 콤보 상자 내용이 절대로 변경되지 않습니다. 아무도 제가 누락 된 부분을 이해하도록 도와 줄 수 있습니까?
콤보 상자에는 문서는 내가 제대로 컨버터를 구현, 또한 아직 http://groovyfx.org/docs/guide/single.html#choiceBoxComboBox
없다?
불행히도이 기능은 저에게 효과적이지 않습니다. 으로 comboBox (ID : '달', 계산기 : model.convertDate) 내 콤보 정의한 을 다음 noparent 블록 사용 : noparent를 { months.items = model.monthList 다음 내 컨트롤러에서 나는 업데이트 모델 model.monthList.clear() model.monthList.addAll (months) 하지만보기가 변경되지 않습니다. 내가 combobox를 조작 할 수 있었던 유일한 방법은 view.months.items에 직접 액세스하여 직접 채 웁니다. 이상적이지 않습니다. – prule
음, 스레딩 문제 일 수 있습니까? 나는 Griffon 1.2.0과 groovyfx/javafx 0.8로 코드를 실행했다. 자세한 내용은 https://gist.github.com/aalmiray/5023272를 참조하십시오. 가이드는 @Threading에 대해서도 자세히 설명합니다. http://griffon.codehaus.org/guide/latest/guide/threading.html#annotationBasedThreading – aalmiray
Heh, 예를 시험해보기 위해 새로운 앱을 만들었으므로 잘 작동합니다. 하지만 여전히 기존 앱에서 제대로 작동하지 않습니다. 시간이 있으면 제대로 작동하도록 노력할 것입니다. 당신의 도움을 주셔서 감사합니다. – prule