开发者

vaadin: moving data from selected row of table1 to table2

I have two questions:

  1. I have two tables, table1 and table2. I need to design an application in such a way that a selected row of table 1 when clicked should get displayed in table 2.
  2. How 开发者_如何学编程do I call a custom table? Suppose I have a class Table with empty constructor and I will pass arguments like Table(pagination). It has to show the table with pagination, Similarly, Table(lazyloading) has to show lazy loading table. Table(pagination, Lazy loading,search) must show all three properties.


What you have to do for nr 1 is that you attach a Clicklistener to your table1 and on a Clickevent you take the selected Object ni table1 and add it to table2. Also add an if to not add rows that already exist in table 2.

This is how you copy data

public void copydata(){
    Object o = table1.getValue();
    if(!table2.getItemIds().contains(o))
        table2.addItem(o);
    table2.setContainerDataSource(table2.getContainerDataSource());
}

When it comes to your second question I have no clue what you are talking about, but I looks like you want to extend the Table class in vaadin to get your own features.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜