AW: How would you realize a delete-Link in a datagrid row?
In addition: my specific problem is, that after clicking on a link which is generated in the datagrid, I am not able to manipulate other components!? How is this possible? - Ursprüngliche Mail Von: Peter Arnulf Lustig u...@yahoo.de An: users@wicket.apache.org Gesendet: Mittwoch, den 30. September 2009, 11:29:03 Uhr Betreff: How would you realize a delete-Link in a datagrid row? 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
AW: How would you realize a delete-Link in a datagrid row?
Hi Ernesto, I don't get it: How can I change the Label-Text? When I try to change the Model of the component Label, nothing happens. The page reloads and the Label has the old Text (not the new one which is meant to be changed) - Ursprüngliche Mail Von: Ernesto Reinaldo Barreiro reier...@gmail.com An: users@wicket.apache.org Gesendet: Mittwoch, den 30. September 2009, 11:38:33 Uhr Betreff: Re: How would you realize a delete-Link in a datagrid row? What about replacing the link. e.g. via AJAX, with a new one containing the Do you really want to delete xyz warning... that once clicked actually deletes your entry... and refreshes the datagrid. You could even use the same link and have a flag that says userWantsToDeleteRow and use it to conditionally change the actions to do and the contents to display. Best, Ernesto On Wed, Sep 30, 2009 at 11:29 AM, Peter Arnulf Lustig u...@yahoo.dewrote: 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
AW: How would you realize a delete-Link in a datagrid row?
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 IModelString 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 ModelString(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
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 IModelString 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 ModelString(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
AW: AW: How would you realize a delete-Link in a datagrid row?
could you tell me how to use this? I have a Dataview like this: dataView = new DataViewAdministrator(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 IModelString 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 ModelString(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
Re: AW: AW: How would you realize a delete-Link in a datagrid row?
table = new AjaxFallbackDefaultDataTable(datatable, createColumns(), contentProvider, 10); @Override protected IColumn?[] createColumns() { IColumn?[] columns = new IColumn[3]; columns[0] = createActionsColumn(); columns[1] = new PropertyColumnString(new ResourceModel(label.name), name, name); columns[2] = new PropertyColumnString(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 DataViewAdministrator(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 IModelString 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 ModelString(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
AW: How would you realize a delete-Link in a datagrid row?
How do you achieve, that the dataview is refreshed after clicking delete? - Ursprüngliche Mail Von: rmattler robertmatt...@gmail.com An: users@wicket.apache.org Gesendet: Mittwoch, den 30. September 2009, 14:51:19 Uhr Betreff: Re: How would you realize a delete-Link in a datagrid row? Another approach would be to created a model window to appear when the delete link is clicked. With the message Are you sure you want to delete xxx? If you select yes, the row is deleted then ajax is used to refresh the dataview. Let me know if you want to use this approach and I will post an example. 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 -- View this message in context: http://www.nabble.com/How-would-you-realize-a-%22delete%22-Link-in-a-datagrid-row--tp2561p25680407.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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
AW: How would you realize a delete-Link in a datagrid row?
yes I thought it... :) How do you achieve that the dataview is refreshed after deletion of a row? - Ursprüngliche Mail Von: rmattler robertmatt...@gmail.com An: users@wicket.apache.org Gesendet: Mittwoch, den 30. September 2009, 16:19:11 Uhr Betreff: Re: How would you realize a delete-Link in a datagrid row? Sorry spelling error not model window but modal window. rmattler wrote: Another approach would be to created a model window to appear when the delete link is clicked. With the message Are you sure you want to delete xxx? If you select yes, the row is deleted then ajax is used to refresh the dataview. Let me know if you want to use this approach and I will post an example. 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 -- View this message in context: http://www.nabble.com/How-would-you-realize-a-%22delete%22-Link-in-a-datagrid-row--tp2561p25681996.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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
Re: AW: How would you realize a delete-Link in a datagrid row?
Wrap the dataview in a WebMarkupContainer . 1) Create a WebMarkupContainer 2) Create your data view 3) Add the dataview into the wmc 4) Don't forget to set .setOutputMarkupId(true); on the dataview 5) On the return of the Modal window refresh the target I.E. target.addComponent(wmcDataTable); Or this example will work with an ajax link instead of a modal window. final WebMarkupContainer wmcDataTable = new WebMarkupContainer(wmcDataTable); wmcDataTable.setOutputMarkupId(true); final DataViewUsers eachUser = new DataViewUsers(eachUser, dp) { protected void populateItem(final ItemUsers item) { final Users user = (Users) item.getModelObject(); item.setModel(new CompoundPropertyModelUsers(user)); item.add(new AjaxLinkUsers(deleteLink, item.getModel()) { public void onClick(AjaxRequestTarget target) { modalUsersDelete.setContent(new VendorProfileUsersDeletePanel(modalUsersDelete.getContentId(), (Users) item.getDefaultModelObject())); modalUsersDelete.show(target); } }); // add items }); eachUser.setItemsPerPage(ROWS_TO_DISPLAY); eachUser.setOutputMarkupId(true); wmcDataTable.add(eachUser); form.add(wmcDataTable); modalUsersDelete = new ModalWindow(modalUsersDelete); modalUsersDelete.setInitialWidth(450); modalUsersDelete.setInitialHeight(230); modalUsersDelete.setOutputMarkupId(true); modalUsersDelete.setTitle(Delete User); modalUsersDelete.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { public void onClose(AjaxRequestTarget target) { target.addComponent(wmcDataTable); } }); form.add(modalUsersDelete); Peter Arnulf Lustig wrote: yes I thought it... :) How do you achieve that the dataview is refreshed after deletion of a row? - Ursprüngliche Mail Von: rmattler robertmatt...@gmail.com An: users@wicket.apache.org Gesendet: Mittwoch, den 30. September 2009, 16:19:11 Uhr Betreff: Re: How would you realize a delete-Link in a datagrid row? Sorry spelling error not model window but modal window. rmattler wrote: Another approach would be to created a model window to appear when the delete link is clicked. With the message Are you sure you want to delete xxx? If you select yes, the row is deleted then ajax is used to refresh the dataview. Let me know if you want to use this approach and I will post an example. 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 -- View this message in context: http://www.nabble.com/How-would-you-realize-a-%22delete%22-Link-in-a-datagrid-row--tp2561p25681996.html Sent from the Wicket - User mailing list archive at Nabble.com. - 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 -- View this message in context: http://www.nabble.com/How-would-you-realize-a-%22delete%22-Link-in-a-datagrid-row--tp2561p25683095.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org