Hello,
I’m creating a web application using Vaadin Framework, but have got stuck with a table element(PagedFilterTable). My table has a column which has a combobox component in each row, now the combobox in the table works properly, but I can’t click on that column to select the table vaue. The row can be selected in the table by clicking the space between combobox and column boundary, but cannot be selected by clicking on the cloumn itself. I searched a lot and found
https://vaadin.com/forum/#!/thread/988648/988647
, tried implementing blackboard addon, but was unsuccessful. My code is roughly below.
PagedFilterTable<IndexedContainer> filterTable;
`public static PagedFilterTable<IndexedContainer> buildPagedFilterTable() {
filterTable = new PagedFilterTable<IndexedContainer>();
filterTable.setFilterBarVisible(true);
filterTable.setSelectable(true);
filterTable.setImmediate(true);
filterTable.setMultiSelect(true);
filterTable.setRowHeaderMode(RowHeaderMode.INDEX);
filterTable.setColumnCollapsingAllowed(true);
filterTable.setContainerDataSource(buildContainer());
filterTable.setVisibleColumns((Object[]) new String[]
{ "Clear", "Name" });
return filterTable;
}`
static int f=1;
private static Container buildContainer() {
IndexedContainer cont = new IndexedContainer();
cont.addContainerProperty("Clear", Component.class, null);// added combobox component
cont.addContainerProperty("Name", String.class, null);
//populating table with database values (table rows will be = no. of rows in db)
Connection con;
ResultSet rs;
Statement cs;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","CGoracle");
cs=con.createStatement();
co=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
rs = cs.executeQuery("select * from ECS_CURRENT");
while(rs.next()) {
ComboBox select_reason_return=new ComboBox();
select_reason_return.setInputPrompt("Select");
select_reason_return.setVisible(true);
select_reason_return.setNullSelectionAllowed(false);
select_reason_return.setInvalidAllowed(false);
select_reason_return.addItem("1.A/c Closed/Transfered");
select_reason_return.addItem("2.No Such A/c");
select_reason_return.addItem("3.Clear");
select_reason_return.select("3.Clear");
select_reason_return.addListener(new Property.ValueChangeListener() {
@Override public void valueChange(ValueChangeEvent event) {
String reason=select_reason_return.getValue().toString();
rowId=FilterTable.getValue(); Notification.show("row id is ="+rowId);
} });
cont.addItem(f);
cont.getContainerProperty(f, "Clear").setValue(select_reason_return);
cont.getContainerProperty(f, "Name").setValue(rs.getString(10)); f++;
}
}
catch (SQLException | ClassNotFoundException e) {
// TODO Auto-generated catch block e.printStackTrace();
} return cont;
}
Is there any option other than blackboard addon? If no, then please help me to solve this problem with it.