Answers.Body: <p><a href="https://craftcms.com/blog/craft-3-2-beta-released" rel="nofollow noreferrer">Craft 3.2 beta</a> adds support sortable custom fields.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-06T17:50:11.593Z
Answers.LastActivityDate: 2019-06-06T17:50:11.593Z
Answers.UserDisplayName: Jameal G
Answers.Body: <p>A few solutions: </p>
  
  <ol>
  <li>Hire someone to create a plugin for you</li>
  <li>Learn PHP in order to include the ability to sort those fields</li>
  <li>Create  a feature request and hope Pixel and Tonic will include it</li>
  </ol>
  
  <p>For those who want to sort entries by custom fields can <a href="https://docs.craftcms.com/v3/extend/updating-plugins.html#modifyentrysortableattributes-modifycategorysortableattributes-modifyassetsortableattributes-modifyusersortableattributes" rel="nofollow noreferrer">read the docs</a> in order to get to know how it is possible</p>
  
  <pre><code>Event::on(Entry::class, Element::EVENT_REGISTER_SORT_OPTIONS, function(RegisterElementSortOptionsEvent $event) {
      $event-&gt;sortOptions[] = [
          'orderBy' =&gt; 'content.field_eventDate', //&lt;-- content. + handle of the field prefixed with field_ to match the database column
          'label' =&gt; 'My Awesome custom search',// &lt;-- name of the label in the CP
          'attribute' =&gt; 'field:10' //&lt;--- id of your field
      ];
  });
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-07T13:58:53.123Z
Answers.Text: Thanks Robin.
  1. I'd rather not have a custom plugin created for me as maintaining it going forward is likely to be an issue.
  2. I'm struggling to keep up with the amount of new code I need to learn for Craft 3 already, as well as the constant changes of development envirionment.
  3. I've added a comment to the existing feature request.
Answers.UserDisplayName: Paul Frost
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-06T17:40:23.513Z
Answers.LastActivityDate: 2018-10-26T22:07:59.950Z
Answers.LastEditDate: 2018-10-26T22:07:59.950Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I have an events section with a custom field of eventDate and it would be very helpful to editors to have them listed in event date order.
  In Craft 2 I used the plugin <a href="https://github.com/mmikkel/CpSortableCustomColumns-Craft" rel="nofollow noreferrer">CP Sortable Custom Columns</a> by Mikkel Rummelhoff but he hasn't ported it to Craft 3 and may not, he says.</p>
  
  <p>I would have thought this option would be useful to many people, so has anyone got any suggestions as to how to achieve it, I'm not a plugin developer myself.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2018-08-06T12:49:38.717Z
Comments.Text: I just went through this same issue and it's not currently possible in Craft 3. Ideally this would be a native abilitiy, but if not a plugin would be fine.
Comments.UserDisplayName: CreateSean
Tags: <control-panel><sorting>
Title: How can I sort entries by a custom field in the CP, Craft 3?
ThreadText: # How can I sort entries by a custom field in the CP, Craft 3?
  
  (Asked by: username_0 on 2018-08-06)
  
  I have an events section with a custom field of eventDate and it would be very helpful to editors to have them listed in event date order.
  In Craft 2 I used the plugin [CP Sortable Custom Columns](https://github.com/mmikkel/CpSortableCustomColumns-Craft) by Mikkel Rummelhoff but he hasn't ported it to Craft 3 and may not, he says.
  
  I would have thought this option would be useful to many people, so has anyone got any suggestions as to how to achieve it, I'm not a plugin developer myself.
  
  **Tags:** control-panel, sorting
  
  > **Comments:**
  > **username_1**: I just went through this same issue and it's not currently possible in Craft 3. Ideally this would be a native abilitiy, but if not a plugin would be fine.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-06-06. Score: 3
  
  [Craft 3.2 beta](https://craftcms.com/blog/craft-3-2-beta-released) adds support sortable custom fields.
  
  
  ---
  
  ### Answer by username_3 on 2018-08-06. Score: 2
  
  A few solutions:
  
  1. Hire someone to create a plugin for you
  2. Learn PHP in order to include the ability to sort those fields
  3. Create a feature request and hope Pixel and Tonic will include it
  
  For those who want to sort entries by custom fields can [read the docs](https://docs.craftcms.com/v3/extend/updating-plugins.html#modifyentrysortableattributes-modifycategorysortableattributes-modifyassetsortableattributes-modifyusersortableattributes) in order to get to know how it is possible
  
  ```
  Event::on(Entry::class, Element::EVENT_REGISTER_SORT_OPTIONS, function(RegisterElementSortOptionsEvent $event) {
      $event->sortOptions[] = [
          'orderBy' => 'content.field_eventDate', //<-- content. + handle of the field prefixed with field_ to match the database column
          'label' => 'My Awesome custom search',// <-- name of the label in the CP
          'attribute' => 'field:10' //<--- id of your field
      ];
  });
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks username_3. 1. I'd rather not have a custom plugin created for me as maintaining it going forward is likely to be an issue. 2. I'm struggling to keep up with the amount of new code I need to learn for Craft 3 already, as well as the constant changes of development envirionment. 3. I've added a comment to the existing feature request.  
  
  ---
  
  