1

Does anyone know how can I track the modified item values in my Editable Table??

The table has a BeanContainer datasource and I would like to update it every time an item is edited or added in my table.

It seems simple but I've been searching everywhere and nothing helped me yet, thank you!

The following Code shows my BeanContainer:

 `public BeanItemContainer createContainer() {              
        BeanItemContainer<PS_SECTION> beans = new BeanItemContainer<PS_SECTION>(PS_SECTION.class);

                   beans.addNestedContainerProperty("PS_SECTION");
                   beans.addNestedContainerProperty("NAME");
                   beans.addNestedContainerProperty("VORDER");

                for (int i = 0; i < list.size(); i++) {
                    PS_SECTION section = list.get(i);

                        Long ps =  section.getPS_SECTION();
                        String na = section.getNAME();
                        Long is = section.getISACTIVE();
                        Long isg = section.getISGLOBAL();
                        Long or = section.getVORDER();

                     Object itemId = beans.addItem(new PS_SECTION(ps, na, is, isg, or));
                }

                return beans;
            }`
natso
  • 97
  • 1
  • 12
  • 1
    If you set this container as a dataSource to your table, you do not need to do anything: all changes in table are done directly on the beans. – agad Dec 12 '16 at 13:52
  • Try the PropertySetChangeListener on your BeanItemContainer. – Chris M Dec 12 '16 at 13:52
  • @ChrisM sounds nice. What should i put in the listener? – natso Dec 12 '16 at 14:00
  • @agad The table is connected to a databse table, so my main purpsose afterwards is to save the modified vaadin table and update the database after a button click. The problem is that in the database table there are already stored some data and I dont want to overwrite all the container in the database. Can i do it then? – natso Dec 12 '16 at 14:07
  • I implememted a table, that tracks changes. If you are interested I can share the code with you. – agad Dec 13 '16 at 10:45
  • @agad Yes of course, If you want to! – natso Dec 14 '16 at 08:13
  • I pushed the most imported files to https://github.com/avackova/extab – agad Dec 14 '16 at 14:11
  • @agad thanks a lot! – natso Dec 14 '16 at 14:18

0 Answers0