我得到了一个页面,其中有两个面板(面板a和面板b)。 我使用这些面板之一(面板b)来显示表格中的一些数据。 我添加了一个表单和一些复选框到这个表格中。 我的第二个面板(面板a)用于显示按钮。我想通过按下面板a的一个按钮来提交面板b的表单,以便我可以对选中的数据执行某些操作。
我搜索了一下,我认为我必须使用ajax提交链接。 但是我不知道如何获取我的选中行。
页面标记:
标记语言:
我搜索了一下,我认为我必须使用ajax提交链接。 但是我不知道如何获取我的选中行。
页面标记:
<wicket:extend xmlns:wicket="http://wicket.apache.org">
<div style="margin-top: 60px">
<h2><span wicket:id="header"></span></h2>
<div wicket:id="categoryButtonPanel"></div>
<div wicket:id="categoryTablePanel"></div>
</div>
</wicket:extend>
这是我在面板B (categoryTablePanel
) 中添加复选框的方法:
Form form = new Form("form");
final List<Category> selectedCategorys = new ArrayList<Category>(); //my list where my selected rows are in
CheckGroup group = new CheckGroup("group", selectedCategorys);
DataView dv = new DataView("categoryList", dataProvider) {
@Override
protected void populateItem(Item item) {
final Category category = (Category) item.getModelObject();
final CompoundPropertyModel<Category> categoryModel = new CompoundPropertyModel<Category>(category);
item.add(new Check("checkBox", item.getModel()));
// some more binded rows
}
};
标记语言:
<wicket:panel xmlns:wicket="http://wicket.apache.org">
<form wicket:id="form">
<span wicket:id="group">
<div class="table table-striped table-hover table-condensed" style="overflow: auto !important;" wicket:id="categoryTable">
<table class="table table-striped">
<thead>
<th><input type="checkbox" wicket:id="selector">check/uncheck all</input></th>
</thead>
<tbody>
<tr wicket:id="categoryList">
<td>
<input type="checkbox" wicket:id="checkBox" />
</td>
</tr>
</tbody>
</table>
<div wicket:id="paginator"></div>
</div>
</span>
</form>
</wicket:panel>
我实际上可以检查每一行,如果我在表单内创建一个普通按钮,我可以使用列表selectedCategorys
对数据进行一些操作。
现在我想在我的第二个面板(categoryButtonPanel
)中添加一个或两个按钮来处理我的数据。但是怎么做呢?
getForm
方法,并将结果传递给另一个面板。 - Rob Audenaerde