我想创建listbox。当用户点击时我想将datagrid显示到下拉列表中。 私有DataGrid objDataGrid;
public CallDataGrid() {
// TODO Auto-generated constructor stub
}
public CallDataGrid(ArrayList<Student> objArrayList) {
System.out.println("Datagrid is now going to set.");
objDataGrid = new DataGrid<Student>();
objLayoutPanel = new SimpleLayoutPanel();
objScrollPanel = new ScrollPanel();
objScrollPanel.add(objDataGrid);
objLayoutPanel.add(objScrollPanel);
objDataGrid.setEmptyTableWidget(new Label("There is no data to display."));
final TextColumn<Student> nameColumn = new TextColumn<Student>() {
@Override
public String getValue(Student object) {
return object.getStrName();
}
};
objDataGrid.addColumn(nameColumn, "User Name");
objDataGrid.setColumnWidth(nameColumn,100,Unit.PX);
final TextColumn<Student> passwordColumn = new TextColumn<Student>() {
@Override
public String getValue(Student object) {
return object.getStrPassword();
}
};
objDataGrid.addColumn(passwordColumn, "Password");
objDataGrid.setColumnWidth(passwordColumn,90,Unit.PX);
objDataGrid.setWidth("190px");
objDataGrid.setHeight("100px");
objDataGrid.setRowData(0, objArrayList);
objDataGrid.setPageSize(5);
//现在如何将此数据网格设置为列表框或建议框?
答案 0 :(得分:0)
没有直接的方法来做你想做的事。您可以使用带右侧按钮的TextBox,而不是ListBox小部件。单击按钮时,将DataGrid放入PopupPanel并通过设置其在TextBox底部的位置来显示它。