title: Wicket SortableDataProvider - how to sort?
body: <p>I've got this webpage using Wicket, which loads in some data with some headlines, and then tons of rows beneath with the corresponding data. </p>
  
  <p>Now, I want my data to be able to get sorted when i click on one of the headlines. From what I've found on google, SortableDataProvider is the way to go. But every example I find requires 1 parameter, whereas when I implement it, it requires two. What to do?</p>
  
  <p>My class to sort is this:</p>
  
  <pre><code>public class SimpleDataView extends WebPage {
  
  public SimpleDataView() {
  
      addNumberOfRecords();
      addHeadlines();
      addRecords();
  }
  
  private void addNumberOfRecords() {
      Data dataModel = getDataModel().getObject();
      add(new Label("size", "Number of records: " + dataModel.numberOfRecords()));
  }
  
  private void addRecords() {
      Data dataModel = getDataModel().getObject();
      ListView records = new ListView("records", dataModel.getRecords()) {
  
          @Override
          protected void populateItem(ListItem item) {
              item.add(new ListView("recordColumn", item.getModel()) {
  
                  @Override
                  protected void populateItem(ListItem item) {
                      item.add(new Label("value", item.getModel()));
                  }
              });
          }
      };
      add(records);
  }
  
  private void addHeadlines() {
      Data dataModel = getDataModel().getObject();
      ListView headlines = new ListView("headlines", dataModel.getHeaders()) {
  
          @Override
          protected void populateItem(ListItem item) {
              item.add(new Label("headlineColumn", item.getModel()));
          }
      };
      add(headlines);
  }
  
  private IModel&lt;Data&gt; getDataModel() {
      IModel&lt;Data&gt; model = new LoadableDetachableModel&lt;Data&gt;() {
  
          @Override
          protected Data load() {
              DataHandler dataHandler = new DataHandlerImpl();
              return dataHandler.getDataFromSource();
          }
      };
      return model;
  }
  
  }
  </code></pre>