I have an short example from Vaadin discuss, and I select records from table Regions of lportal database Liferay:
I add the portlet in liferay and the table is displayed with blank records.
Records are selected from the ranks of the table but not shown.
I attach a screenshot.
Where can I find complete help manual with details to work with records and tables (or datatables etc …) in vaadin ?
Never used QueryContainer, but can’t this statement break the things and produce empty table ? If you comment it out, will the table display the data ?
If you close the query the Table cannot pull data from the query anymore, thus leading an empty table. You should close the query only when the table is not displayed anymore.
I would like to order rows in table clicking on header:
In code vaadin table(Grid) —> sampler (Table order): http://demo.vaadin.com/sampler/#Components/Table%20(Grid)/TableSorting
…
// selectable
table.setSelectable(true);
table.setMultiSelect(true);
table.setImmediate(true); // react at once when something is selected
// connect data source
table.setContainerDataSource(ExampleUtil.getISO3166Container());
// turn on column reordering and collapsing
table.setColumnReorderingAllowed(true);
table.setColumnCollapsingAllowed(true);
Which parameter in tblDataTable.setContainerDataSource(xxxxx); can I use? (Without QueryContainer)
If not, Where can I find an example ExampleUtil.getISO3166Container() ?
How can I change QueryContainer? in :
qcSQL = new QueryContainer("SELECT * FROM Region order by regionId,countryId,regionCode,name",con);
tblDataTable = new Table();
tblDataTable.setContainerDataSource(qcSQL);
To do that, the Container that is used with the table must implement Container.Sortable. One way would be to extend / copy QueryContainer and implement the required interface. You could look at IndexedContainer for an example implementation. (I think IndexedContainer does the sorting at java level, when a sorting QueryContainer should probably do it at database level)
…
qcSQL = new QueryContainer(“SELECT * FROM Region”,con);
tblDataTable = new Table();
IndexedContainer ic = new IndexedContainer(qcSQL.getItemIds());
tblDataTable.setContainerDataSource(ic);
tblDataTable.setVisible(true);
tblDataTable.setColumnReorderingAllowed(true);
This question is not really related to the old thread so it would have been better to ask it separately, but: take a look at the Table.CellStyleGenerator interface. There is also
an example of it in the Sampler.