Table with OptionGroup

Dear all,

I created a Table with an OptionGroup in each row.
The OptionGroup itself functions as expected, but I need to know the table row in which the user changed the OptionGroup.
So far, I could not get hold of this table row yet.

Can someone explain how to do this?



No reaction, so I will try to rephrase my question:

If the table contains a checkbox in each row, this checkbox can be associated with a rowId, which can be ‘retrieved’ in the ButtonClickListener as follows:

		for (int i = 0; i < 15; ++i)
			String rowId 		= "rowId " + i;
			CheckBox cb = new CheckBox(null);
			cb.setData(rowId);	// to associate checkbox with table row
			// listeners
			cb.addListener(new Button.ClickListener() 
				public void buttonClick(ClickEvent event) 
					// determine row
					String rowId = (String)event.getButton().getData();
		              "rowId = " + rowId);
                                        // ... real code
			myTable.addItem(new Object[] { rowId, cb }, rowId);

How can I do the same with an optionGroup instead of a checkBox?

Any help appreciated,

Exactly the same way, but use a ValueChangeListener instead.

Hi Thomas,

Thanks, I tried that: but in the method valueChange(ValueChangeEvent event)
there is no event.getButton (or event.getOptionGroup) method.

Perhaps I overlook something, but that is where i am stuck.


you can use getProperty() and cast that to OptionGroup. The API isn’t really the best, but it works :slight_smile:

Yes, it works!

And the question (as usual): who is to blame, the API, the documentation or the user …

Thanks again,