我需要使用编辑、保存、取消、删除按钮以表格格式显示数据库中的数据,它在检票口中称为可编辑网格。
在单击编辑按钮后的表格行中,数据应显示在 2 个下拉选项中,并从第一个下拉列表中选择数据,然后应根据第一个下拉列表的选择更改第二个下拉数据模型。
我已经浏览了https://github.com/wicketstuff/core/tree/master/editable-grid-parent。但它只显示可编辑的网格,在检票口中有 1 个下拉菜单,我想要 2 个下拉菜单。请帮助解决这个问题。
更新:我用过这个
private List<AbstractEditablePropertyColumn<Person, String>> getColumns()
{
List<AbstractEditablePropertyColumn<Person, String>> columns = new ArrayList<AbstractEditablePropertyColumn<Person, String>>();
stateDropDownPropertyColumn = new AbstractEditablePropertyColumn<Person, String>(new PropertyModel<String>(this, "selectedMake"), "state")
{
private static final long serialVersionUID = 1L;
public EditableCellPanel<Person> getEditableCellPanel(String componentId)
{
return getStateDDCellpanel(componentId,this);
}
};
cityDropDownPropertyColumn = new AbstractEditablePropertyColumn<Person, String>(new Model<String>("CarModel"), "city"){
private static final long serialVersionUID = 1L;
@Override
public EditableCellPanel<Person> getEditableCellPanel(String componentId) {
// TODO Auto-generated method stub
return getCityDDCellpanel(componentId,this);
}};
columns.add(stateDropDownPropertyColumn);
columns.add(cityDropDownPropertyColumn);
return columns;
}
private EditableRequiredDropDownCellPanel<Person, String> getStateDDCellpanel(String componentId,
AbstractEditablePropertyColumn<Person, String> DropDownPropertyColumn){
this.stateComponentID = componentId;
this.stateDropDownPropertyColumn = DropDownPropertyColumn;
stateDropDownCellPanel = new EditableRequiredDropDownCellPanel<Person, String>(stateComponentID, stateDropDownPropertyColumn, stateChoices);
return stateDropDownCellPanel;
}
private EditableRequiredDropDownCellPanel<Person, String> getCityDDCellpanel(String componentId,
AbstractEditablePropertyColumn<Person, String> DropDownPropertyColumn){
this.cityComponentID = componentId;
this.cityDropDownPropertyColumn = DropDownPropertyColumn;
cityDropDownCellPanel = new EditableRequiredDropDownCellPanel<Person, String>(cityComponentID, cityDropDownPropertyColumn, cityChoices);
cityDropDownCellPanel.setOutputMarkupId(true);
cityDropDownCellPanel.setOutputMarkupPlaceholderTag(true);
return cityDropDownCellPanel;
}
我对此一无所知,我需要在哪里放置下拉单元格的行为。