GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Editable Grid Editable Grid
Martijn Dashorst edited this page
A grid component with add/edit/delete feature all at once, apart from supporting sorting/filtering/paging.
<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 ? Clone this wiki locally |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |