I have a UsersPanel that contains a UsersTablePanel and a delete link (Ajax). UsersTablePanel contains a DataTable (Ajax) with the first column only for selection (checkboxes), and a method getSelectedIds():List<Long>. The user flow is very simple: check (select) some rows from table and click on delete link. I want to popup a confirmation message like "Remove X users ?" where X is number of selected rows on delete. How can I do that?
I have tried something like this but without success: public class UsersPanel extends Panel { @SpringBean(name = "userService") private UserService userService; private UsersTablePanel usersTablePanel; public UsersPanel(String id) { super(id); // add users panel with the users table add(usersTablePanel = new UsersTablePanel("usersTablePanel")); // add delete link add(new AjaxLink("deleteUsers") { @Override public void onClick(AjaxRequestTarget target) { List<Long> selectedIds = usersTablePanel.getSelectedIds(); int size = selectedIds.size(); System.out.println(">" + size); if (size > 0) { userService.deleteUsers(selectedIds); target.addComponent(usersTablePanel.getDataTable()); } } @Override protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() { @Override public CharSequence decorateScript(CharSequence script) { List<Long> selectedIds = usersTablePanel.getSelectedIds(); int size = selectedIds.size(); System.out.println(">>" + size); if (size > 0) { return "if(!confirm('Remove " + size + " users ?')) return false;" + script; } return script; } }; } }); } } Thanks in advance, Decebal __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user