title: Java Wicket AJAX refresh paginated DataView
body: <p>I have a page that has a list of Hibernate entities that is loaded dynamically on display of the page. The list is used to create a DataView, which is used to display a paginated list of the entries in the list in a container. Each entry in the list has a delete icon on it. When the delete icon is pressed, I lazy delete the entry, reload the list with entities (which will no longer contain the lazy deleted entry), and reload the container, but the entry is still there in the container until I reload the whole page. Why?</p>
  
  <pre><code>public class LogPage extends ProjectPage{
  
      @SpringBean
      private LogDao logDao;
      @SpringBean
      private LogEntryDao logEntryDao;
  
      private List&lt;LogEntry&gt; logEntryList;
      private DataView&lt;LogEntry&gt; dataView;
      private WebMarkupContainer logEntryListContainer;   
  
      public LogPage(PageParameters pp) {
          super(pp);
          Project activeProject = SciProSession.get().getActiveProject();
          Log log = null;
          if (activeProject.getLog()==null){
              log = new Log(activeProject);
              log = logDao.save(log);
          }else{
              log = activeProject.getLog();
          }
          logEntryList = logEntryDao.findAll();
          Collections.sort(logEntryList);
  
          logEntryListContainer = new WebMarkupContainer("logEntryListContainer");
          logEntryListContainer.setOutputMarkupId(true);
  
          dataView = (DataView&lt;LogEntry&gt;) new DataView&lt;LogEntry&gt;("logEntryDataView", new ListDataProvider(logEntryList)) {
              private static final long serialVersionUID = 1L;
  
              @Override
              protected void populateItem(final Item&lt;LogEntry&gt; item) {
                  final LogEntry logEntry = item.getModelObject();
  
                  item.add(new Label("contents", logEntry.getContents()));
                  item.add(new Label("creator", logEntry.getCreator().toString()));
  
                  AjaxActionIcon deleteIcon = new AjaxActionIcon("deleteIcon", ImageIcon.ICON_DELETE){
                      private static final long serialVersionUID = 1L;
                      @Override
                      protected void onClick(AjaxRequestTarget target) {
                          LogEntry toBeRemoved = logEntryDao.reLoad(logEntry);
                          toBeRemoved.setDeleted(true);
                          logEntryDao.save(toBeRemoved);
                          logEntryList = logEntryDao.findAll();
                          target.addComponent(logEntryListContainer);
  
                      }
                  };
                  item.add(deleteIcon);               
              }
          };
  
          dataView.setItemsPerPage(10);
          logEntryListContainer.add(dataView);
          logEntryListContainer.add(new PagingNavigator("navigator", dataView));
          add(logEntryListContainer);
  
      }
  
  
  }
  </code></pre>