populate a comboBox in Griffon App dynamically

Posted by kulkarni on Stack Overflow See other posts from Stack Overflow or by kulkarni
Published on 2010-02-21T06:48:36Z Indexed on 2010/03/14 18:05 UTC
Read the original article Hit count: 422

Filed under:
|
|
|

I have 2 comboBoxes in my View of Griffon App (or groovy swingBuilder)

country = comboBox(items:country(), selectedItem: bind(target:model, 'country', 
            value:model.country), actionPerformed: controller.getStates)

state = comboBox(items:bind(source:model, sourceProperty:'states'), 
                   selectedItem: bind(target:model, 'state', value:model.state))

The getStates() in the controller, populates @Bindable List states = [] in the model based on the country selected.

The above code doesn't give any errors, but the states are never populated.

I changed the states from being List to a range object(dummy), it gives me an error MissingPropertyException No such property items for class java.swing.JComboBox.

Am I missing something here? There are a couple of entries related to this on Nabble but nothing is clear. The above code works if I had a label instead of a second comboBox.

© Stack Overflow or respective owner

Related posts about griffon

Related posts about groovy