table = new AjaxFallbackDefaultDataTable("datatable", createColumns(),
contentProvider, 10);
@Override
protected IColumn<?>[] createColumns() {
IColumn<?>[] columns = new IColumn[3];
columns[0] = createActionsColumn();
columns[1] = new PropertyColumn<String>(new
ResourceModel("label.name"), "name", "name");
columns[2] = new PropertyColumn<String>(new
ResourceModel("label.owners"), "owners", "owners");
return columns;
}
So "datatable" would become "benutzer", contentProvider would become new
AdministratorDataProvider(), and you'd have to add your own columns.
(The number 10 is the number of rows you want to show on a page.)
On the Wicket-examples site is an extensive example of this construct.
Regards,
Linda
Peter Arnulf Lustig wrote:
could you tell me how to use this?
I have a Dataview like this:
dataView = new DataView<Administrator>("benutzer", new
AdministratorDataProvider()) {
}
thanks!
----- Ursprüngliche Mail ----
Von: Linda van der Pal <lvd...@heritageagenturen.nl>
An: users@wicket.apache.org
Gesendet: Mittwoch, den 30. September 2009, 13:37:44 Uhr
Betreff: Re: AW: How would you realize a "delete"-Link in a datagrid row?
I used this with a AjaxFallbackDefaultDataTable and then I didn't have
to tell it that the DB had changed.
Peter Arnulf Lustig wrote:
Thank you! Your solution is really nice.
It functions well!
I have a problem which the datagrid. After removing a row in the database it
throws an exception, because wicket is unable to populate an item (I assume the
deleted one)
How can I tell wicket to reload the datagrid because something in the DB
changed.
----- Ursprüngliche Mail ----
Von: Linda van der Pal <lvd...@heritageagenturen.nl>
An: users@wicket.apache.org
Gesendet: Mittwoch, den 30. September 2009, 11:43:40 Uhr
Betreff: Re: How would you realize a "delete"-Link in a datagrid row?
I created a deteletButton as follows. I have a DeleteButton innerclass, and a
method that adds this button to the panel that is shown in the table.
private class DeleteButton extends Button {
private static final long serialVersionUID = 1L;
public DeleteButton(final String id, final IModel<String> model) {
super(id, model);
}
@Override
public void onSubmit() {
try {
deleteData((String) getModelObject()); // a method that does the
actual data deletion in the database
} catch (SQLException se) {
error(StringResources.SQLERROR_GET + '\n' + se.getMessage());
} catch (IOException ie) {
error(StringResources.IOERROR + '\n' + ie.getMessage());
}
}
@Override
public boolean isEnabled() {
return isEditingAuthorised();
}
}
private void addDeleteLink(final IModel<?> model) {
String id = (String)getIdFromModel(model); // a method that extracts
the id from the model (based on what kind of class is in the model)
Button deleteButton = new DeleteButton("delete", new
Model<String>(id));
deleteButton.add(new Image("deleteIcon", new
ResourceReference(EmptyIconReference.class, "list-remove.png")));
deleteButton.add(new SimpleAttributeModifier("onclick", "return
confirm('Are you sure?');"));
add(deleteButton);
}
I hope this helps.
Regards,
Linda
Peter Arnulf Lustig wrote:
Hi,
I'd like to create a delete link where you can delete a row in a datagrid. But when you
click on the delete link, the delete label should change and a warning occurs: "Do
you really want to delete xyz".
After the second click it finally deletes the content.
How can I achieve that? Could you verbalize the procedure?
Thanks!!
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.409 / Virus Database: 270.13.115/2404
- Release Date: 09/30/09 05:52:00
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.13.115/2404 - Release Date: 09/30/09 05:52:00
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.409 / Virus Database: 270.13.115/2404 - Release Date: 09/30/09 05:52:00
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org