Hi, I have a DataTable in which two columns are holding checkboxes (when selecting a checkbox, the other in the same row will be unselected). We chose checkboxes to enable the user to remove selections at all. I want to add a 'Select All' to the header. *My problem is how do I get the component of the header to add it to the ajax checkbox of the column?* I can solve this problem by adding the whole table to ajax checkboxes, but I prefer to pass as few lines in the ajax calls. Here's some code: private AbstractColumn newActionCheckboxColumn(final String approvedRejectReassign) { AbstractColumn p = new AbstractColumn(new ResourceModel("EditingTasksTablePanel." + approvedRejectReassign)) { private static final long serialVersionUID = 1L;
public void populateItem(Item cellItem, String componentId, IModel rowModel) { EditingTask task = (EditingTask) rowModel.getObject(); cellItem.add(new TaskActionCheckboxPanel(componentId, task, approvedRejectReassign, cellItem.getParent() .getParent())); } @Override public Component getHeader(String componentId) { return new TaskActionCheckboxAllPanel(componentId, dataProvider, "all"+approvedRejectReassign, EditingTasksTablePanel.this); } }; return p; } TaskActionCheckboxPanel(String id, final EditingTask task, String approveRejectProperty, final Component... rowComponent) { super(id); final AjaxCheckBox checkbox = new AjaxCheckBox("checkbox", new PropertyModel(task, approveRejectProperty)) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { for (Component component : rowComponent) { target.addComponent(component); } } }; add(checkbox); } public TaskActionCheckboxAllPanel(String id, EditingTasksSortableDataProvider tasksSortableDataProvider, String checkAllProperty, final Component updatedComponent) { super(id); final AjaxCheckBox checkbox = new AjaxCheckBox("checkbox", new PropertyModel(tasksSortableDataProvider, checkAllProperty)) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { target.addComponent(updatedComponent); } }; add(checkbox); this.setOutputMarkupId(true); } * I will make the two panels the same after doing all changes... thanks Eyal Golan egola...@gmail.com Visit: http://jvdrums.sourceforge.net/ LinkedIn: http://www.linkedin.com/in/egolan74 P Save a tree. Please don't print this e-mail unless it's really necessary