-
Notifications
You must be signed in to change notification settings - Fork 298
Editable Grid
mnadeem edited this page Feb 3, 2013
·
9 revisions
A grid component with add/edit/delete feature all at once, apart from supporting sorting/filtering/paging.
- Add Row
- Edit Row
- Delete Row
- editable-grid-parent
- wicketstuff-editable-grid
- editable-grid-examples
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-editable-grid</artifactId>
<version>[version]</version>
</dependency>
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-editable-grid</artifactId>
<version>6.0-SNAPSHOT</version>
</dependency>
<repository>
<id>wicketstuff-core-snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
add(new EditableGrid<Person, String>("grid", getColumns(), new EditableListDataProvider<Person, String>(getPersons()), 5, Person.class)
{
private static final long serialVersionUID = 1L;
@Override
protected void onError(AjaxRequestTarget target)
{
target.add(feedbackPanel);
}
@Override
protected void onCancel(AjaxRequestTarget target)
{
target.add(feedbackPanel);
}
@Override
protected void onDelete(AjaxRequestTarget target, IModel<Person> rowModel)
{
target.add(feedbackPanel);
}
@Override
protected void onSave(AjaxRequestTarget target, IModel<Person> rowModel)
{
target.add(feedbackPanel);
}
});
private List<AbstractEditablePropertyColumn<Person, String>> getColumns()
{
List<AbstractEditablePropertyColumn<Person, String>> columns = new ArrayList<AbstractEditablePropertyColumn<Person, String>>();
columns.add(new RequiredEditableTextFieldColumn<Person, String>(new Model<String>("Name"), "name"));
columns.add(new RequiredEditableTextFieldColumn<Person, String>(new Model<String>("Address"), "address"));
columns.add(new AbstractEditablePropertyColumn<Person, String>(new Model<String>("Age"), "age")
{
private static final long serialVersionUID = 1L;
public EditableCellPanel<Person> getEditableCellPanel(String componentId)
{
return new EditableRequiredDropDownCellPanel<Person, String>(componentId, this, Arrays.asList("10","11","12","13","14","15"));
}
});
return columns;
}
<div wicket:id="grid"></div>
Path is: /jdk-1.6-parent/editable-grid-parent
Path is: /jdk-1.6-parent/editable-grid-parent
In method grid is really awesome++, However It does not allow us to add a row, more over editable components are not configurable, it is always text field, what if I want drop down, or textare ?