Disable detail when no item selected in master table

I have a master-detail relationship displayed on a single screen. The user gets to edit any row upon selecting it. Of course, it there is no row selected, or if the list is or becomes empty, the detail side of the screen must be disabled from editing.
I’m assuming I need to create a property change listener to monitor changes in either the table or the datasource, but I am not finding a suitable way to do this. The table does not offer any addPropertyListener, and the datasource only monitors individual items (not the overall collection of items).
What is the correct way to implement this? Thanks

Hi Eric,

Did you generate the Single Screen by Studio? Because it should work out of the box, as it calls


method (fine an example here) in the overridden


method of the screen, which does the trick.


Thanks for the reply. My use-case might be a bit different. I have multiple master-detail relationships on separate tabs of the screen. Perhaps the init for the screen doesn’t handle this? I did come up with some code that enables the edit controls (which are in a grid) when the user clicks on a selection. Does this seem reasonable? Beyond this, I still need to handle the cases when the user creates a new row or deletes all of the rows…

com.vaadin.ui.Table vaadinTable = tblPastMed.unwrap(com.vaadin.ui.Table.class);
        vaadinTable.addItemClickListener(new ItemClickEvent.ItemClickListener() {
            public void itemClick(ItemClickEvent itemClickEvent) {
                WebGridLayout c = (WebGridLayout)getComponentNN("grdPastMedEdit");

Hi Eric,

It seems that your problem is quite similar to what Single Screen template is designed for. So you can investigate how it works quite easily. For example, it demonstrates how to use datasource listeners. If it doesn’t help, please attach a small sample project showing your problem.