Add/Remove combobox dynamically based on selection

Hi All,
I am new to Vaadin and I have requirement to dynamically add new combobox based on my selection and populate the values for each of the combobox. Upon changing the selection, the new combobox that was added should be replace with the combobox matching the new selection. How can this be accomplished? Any help or link to an example is very much appreciated.

Scenario:
Initially combobox 1 will be added by default.
If value 1 in combobox1 is selected, combobox 2 should be created/added
if the selection in combobox1 is changed to value 2, the combobox 3 should be created or added and combobox 2 created in the previous selection should be removed

Please let me know if there are any questions

Thanks

Hi, I would recommend to create all the combo boxes but use setVisible API (Java) or hidden attribute (web component). This way it would be easier than re-attaching components to the DOM.

Thanks Serhii for the suggestion. I did try that. I was having trouble getting reference to the value.
I have a list of object in the form

{
	id: 1,
	qTxt : "Q1",
	answers : [{
		id: 1,
		aTxt : "A11"
		qId : "Q2"
	},
	{
		id: 2,
		aTxt : "A12"
		qId : "Q3"
	}
	]
}

Combo Box would be as shown below

Label : Combo Items
Q1 : A11
	 A12
	 A13
Q2 : A21
	 A22

qTxt are the label to the combo and aTxt are the items of the combo. Upon selecting the aTxt in the combo, the next combo should be shown based on the qId value. This list is dynamic and can grow. I am not able to get qId value on change of selection. Where should I set the value of qId so I get the reference to that n the change even. If I go back to the one of the previous combo and change the selection, all the subsequent selections should be reset but retain the ones before that combo.