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 DataView<Users> eachUser = new DataView<Users>("eachUser", dp) {
protected void populateItem(final Item<Users> item) {
final Users user = (Users)
item.getModelObject();
item.setModel(new
CompoundPropertyModel<Users>(user));
item.add(new AjaxLink<Users>("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 <[email protected]>
> An: [email protected]
> 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: [email protected]
>>> For additional commands, e-mail: [email protected]
>>>
>>>
>>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/How-would-you-realize-a-%22delete%22-Link-in-a-datagrid-row--tp25677771p25681996.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/How-would-you-realize-a-%22delete%22-Link-in-a-datagrid-row--tp25677771p25683095.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]