我们在我们的网站(Vaadin Table)中使用了很多表格,但是我们的客户告诉我们他们希望能够在表格内进行编辑。现在,我知道这是可能的表(我已经得到这个工作),但我有点像编辑机制更好的网格。有没有简单的方法将Vaadin Table转换成Vaadin Grid?由于Grid不是替代品,我知道它需要一些转换工作。只是想知道人们有多难找到它,以及是否有任何文件在做这样的转换。将Vaadin Table转换为Vaadin Grid
这是我们正常的表的使用情况:
public final class ReplenishmentOrderMgmtView extends VerticalLayout implements View {
private final Table table;
private static final String[] DEFAULT_COLLAPSIBLE = {
"contactFirstName",
"contactLastName",
"supplierName",
"carrier", "carrierService", "trackingNumber"
};
private static final Object[] VISIBLE_COLUMNS = {
"barcode",
"contactUserId",
"contactFirstName",
"contactLastName",
"PO",
"orderId",
"cellId",
"cellName",
"wmsItem",
"description",
"supplierId",
"supplierName",
"statusDesc",
"resizedBinQty",
"expectedOnDockDate",
"shipQuantity",
"receivedQty",
"lastReceiptDate",
"carrier",
"carrierService",
"trackingNumber",
"creationDate"
};
private static final String[] COLUMN_NAMES = {
"Barcode",
"Contact User",
"First Name",
"Last Name",
"PO Number",
"Replenishment Order Id",
"Cell Id",
"Cell Name",
"Part",
"Description",
"Supplier Id",
"Supplier Name",
"Status",
"Resized Bin Qty",
"Expected On Dock Date",
"Ship Quantity",
"Received Qty",
"Last Receipt Date",
"Carrier",
"Carrier Service",
"Tracking Number",
"Creation Date"
};
private Table buildTable() {
final Table table = new Table();
table.setSizeFull();
table.addStyleName(ValoTheme.TABLE_BORDERLESS);
table.addStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES);
table.addStyleName(ValoTheme.TABLE_COMPACT);
table.setSelectable(true);
table.setColumnCollapsingAllowed(true);
table.setColumnReorderingAllowed(true);
updateList(table);
table.setSortContainerPropertyId("creationDate");
table.setSortAscending(true);
table.setColumnHeaders(COLUMN_NAMES);
// Allow dragging items to the reports menu
// table.setDragMode(TableDragMode.MULTIROW);
table.setMultiSelect(false);
table.addActionHandler(new ReplenishmentOrdersActionHandler());
table.addValueChangeListener(event -> this.selectItemFromTable());
table.setImmediate(true);
return table;
}
}
也有一些有约束力的参与在那里 - 我的数据源是一个Java bean。显然,我只包含会影响表本身的代码。任何意见或意见将不胜感激。