title: How to add sortable column for member list in Silverstripe admin?
body: <p>I am struggling to add sort functionality on one of my member summary fields in admin.</p>
  
  <p>I have extended the Silverstripe member class using:</p>
  
  <pre><code>class MyMemberExtension extends DataExtension
  </code></pre>
  
  <p>I have added a few fields to the default gridfield in admin:</p>
  
  <pre><code>private static $db = array(
      'Organisation' =&gt; 'Varchar(100)'
  );
  
  private static $summary_fields = array( 
      'FirstName' =&gt; 'First Name', 
      'Surname' =&gt; 'Surname', 
      'Email' =&gt; 'Email', 
      'OrganisationName' =&gt; 'Organisation Name', 
      'LastVisited' =&gt; 'Last Visited',
      'NumVisit' =&gt; 'Num Visits'
  );
  
  private static $casting = array(
      'OrganisationName' =&gt; 'Varchar(100)'
  );
  
  public function getOrganisationName() {
      return $this-&gt;owner-&gt;Organisation; 
  }
  </code></pre>
  
  <p>...and that all works nicely.</p>
  
  <p>However, only the core fields like LastVisited are giving me sort arrows on the column headers.</p>
  
  <p>I'm currently stuck as to how to implement the sort on my Organisation field. I tried adding :</p>
  
  <pre><code>public function getCMSFields()
  {
      $fields = parent::getCMSFields();
  
      $grid = $fields-&gt;dataFieldByName('Organisation');
      $gridConfig = $grid-&gt;getConfig();
      $gridConfig-&gt;addComponent(new GridFieldSortableHeader());
      return $fields;
  }    
  
  public function getEditForm($id = null, $fields = null) {
      $form=parent::getEditForm($id, $fields);
  
      $model = singleton($this-&gt;modelClass);
  
      // add sorting if we have a field for... 
      if (class_exists('GridFieldSortableRows')
          &amp;&amp; $model-&gt;hasField('Organisation')
          &amp;&amp; $gridField=$form-&gt;Fields()-&gt;dataFieldByName($this-&gt;sanitiseClassName($this-&gt;modelClass))) {
          if($gridField instanceof GridField) {
              $gridField-&gt;getConfig()-&gt;addComponent(new GridFieldSortableRows('Organisation'));
          }
      }
      return $form;
  }
  </code></pre>
  
  <p>...to my class, but I'm not convinced these are even being called, as even if I just return null from these two functions nothing changes.</p>
  
  <p>I have found a few answers that deal with extensions to ModelAdmin, but not for the core Member list. Thanks!</p>