Skip to content

Editable Grid

mnadeem edited this page Feb 3, 2013 · 9 revisions

About

A grid component with add/edit/delete feature all at once, apart from supporting sorting/filtering/paging.

Features

  • Add Row
  • Edit Row
  • Delete Row

Maven Artifacts

  • editable-grid-parent
  • wicketstuff-editable-grid
  • editable-grid-examples

Maven Stable

<dependency>
	<groupId>org.wicketstuff</groupId>
	<artifactId>wicketstuff-editable-grid</artifactId>
	<version>[version]</version>
</dependency>

Maven Development

<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>

Java

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;
	}

HTML

<div wicket:id="grid"></div>

Project Maintainers

mnadeem

Source code

core-6.0.x Branch

Path is: /jdk-1.6-parent/editable-grid-parent

master Branch

Path is: /jdk-1.6-parent/editable-grid-parent

Comparision

Inmethod grid && Editable Grid

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 ?

Clone this wiki locally