Fetch DebugId in valueChange() of valueChangeListener

Hello all,

I am new to Vaadin and was trying to add multiple Nativeselect using a for loop with different debugId which is created at the runtime.


           for(int i=0; i< 3; i++)
           {
               nativeSelect  =  new NativeSelect();
               nativeSelect.setDebugId ( i+"@qa" );
               nativeSelect.addListener(this);
           }

For its listener part I have implemented Property.ValueChangeLisener and implemented its method valueChange(ValueChangeEvent event),

now mine problem is, that i want to get the currently clicked NativeSelect DebugId which i have set while creating it.

Please show me the way to get it, do write.

Thanks :grin:

Cheers!!!

The following does the trick:

nativeSelect.addListener(new ValueChangeListener() {
	public void valueChange(ValueChangeEvent event) {
		String id = ((NativeSelect) event.getProperty()).getDebugId();
	}
});

But sounds like you are using debug ids to something that could be done some another (maybe better?) way.

Thanks alot for the solution I have got my result exactly what I needed.

Thanks once Again :grin:

Cheers!!!