Table doesn't refresh

EDIT: One solution was initializing the fields of the bean i’m passing to the list when the list happends to be empty or null.
Should it matter that the values themselves are null? In another place i pass values intermingled with null with no problem.
Also i used this passing a bean with null fields tehnnique somewhere else, and it didn’t raise any problems, although it is triggering the update from a subwindow button event, instead of pushing the same button that loads the layout in the first place - maybe that matters too.

I have a table that is updated when the data changes on the server, after a button is clicked whose event makes the verification that it changed first. The problem with it is that the data can be be a null or empty list, in which case, i initialize a list and put a mock object in it for the table to display empty. The problem is that after the data changes, and the list returned isn’t null anymore, it wouldn’t refresh the table like the usual. If the first list that’s passed to the container data source isn’t a mock one, it updates just fine.


It is notable though that if i change view to something else when this happends, then come back (though objects from the server side are reused), the tables reload from the server side, and the problem table is displaying the new data.

Going to add the relevant code i’m using to do this:

Normal initialization.

if(globalTable == null)
			globalTable = new ExtractionsFrequencyTable();
		
		List<NrsUnicityFrequency> list = returnMatchGroupFrequency(this.nrs);
		if (list != null && !list.isEmpty()) {
			localTable = new ExtractionsFrequencyTable(list);
			localTable.setPageLength(1);
		}
		else {
			list = new ArrayList<NrsUnicityFrequency>();
			list.add(new NrsUnicityFrequency());
			localTable = new ExtractionsFrequencyTable(list);
			localTable.setPageLength(1);
		}

		if (localTable != null) {
			drawContent(globalTable, localTable, new VerticalLayout());
		}

Somewhere else in the code, where it runs after i check the data changed.
The repaints do not work, the add/remove works of course, but generates other problems

if (list != null && !list.isEmpty()) {
					if (unicity.localTable != null) {
						unicity.localTable
								.setContainerDataSource(new BeanItemContainer<NrsUnicityFrequency>(
										list));
						unicity.localTable
								.setVisibleColumns(ExtractionsFrequencyTable.NATURAL_COL_ORDER);
//						unicity.localTable.requestRepaint();
//						unicity.localTable.detach();
//						unicity.localTable.attach();
//						unicity.localTable.requestRepaintAll();
//						unicity.localTable.requestRepaintRequests();
//						unicity.mainLayout.removeComponent(unicity.localTable);
//						unicity.mainLayout.addComponent(unicity.localTable);
					}
				} else {
					list = new ArrayList<NrsUnicityFrequency>();
					list.add(new NrsUnicityFrequency());
					unicity.localTable = new ExtractionsFrequencyTable(list);
					unicity.localTable.setPageLength(1);
				}

Hi,

Did you by any chance try the
Refresher
component?

Coz I had a similar problem & the
Refresher
helped me on it.

http://vaadin.com/forum/-/message_boards/message/200320

Cheers,
Asela.

Hello,

Thank you for reminding me. No, i haven't tried it, i had it bookmarked and forgot about it. My problem is solving a one user event refresh issue which happends at the beginning of the application when the data is generic still, so the Refresher is a bit much, [b]

i’m hoping for an inner workings fix. :grin:
[/b] I fixed it with a mock object for now, like i said where I edited in the above post.

P.S. I’ll set up a demo for this bug sometime when i get the time, but living in a black-hole country like Romania eats up all my time and sucks the life out too, so i have to concentrate on more dire matters. :grin:
My use case is that i generate a bunch of numbers and put them in a byte, then i pass the byte
to another class wherei do some stuff and initializing, but, in which case i get a null or empty list, i put a bean with no initialized fields in the list and pass it to the table. At this time, if also the byte is 0, 0, 0 etc., although initialized explicitly, it stops refreshing the table,
although in the debugger i clearly see it sets a new bean container to the table
datasource from a proper list from the new byte with generated numbers,
but the change doesn’t reflect like the usual in the UI
, which remains as if it still had the null field bean attached to it or something.

EDIT: P.S. Although Java should initialize the fields of the bean with 0, i haven’t checked if it does, although i’m most certain that it does, but certainly it doesn’t show up in the interface as if it does (because when i give it a bean with explicit initialization, 0s appear - as i use 0 to initialize them too, hmm). So something screwy is going on… still no time to check.

Regards,
Tudor Raneti.