Answers.Body: <p>After a little head-scratching, the only way I could get this working was to register an AssetBundle (to load in my own JS), and making use of the Garnish toolkit as follows:</p>
  
  <pre><code>$(document).ready(function() {
      var statusSet = false;
  
      Craft.elementIndex.on('updateElements selectSource', function(data) {
          if (!statusSet) {
              // Find the option (and make sure it actually exists)
              $option = data.target.statusMenu.$options.filter('a[data-status="live"]:first');
  
              if ($option.length) {
                  data.target.setStatus($option.data('status'))
                  statusSet = true;
              }
          }
      });
  });
  </code></pre>
  
  <p>This should only trigger the <code>setStatus()</code> process once, even when navigating between sources (which will also be filtered to to the saved status state of "Live"), but allows the user the freedom to change the status again if they so choose.</p>
  
  <p>I hope this helps :)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-05T13:45:06.813Z
Answers.LastActivityDate: 2020-06-05T13:45:06.813Z
Answers.UserDisplayName: zesda
Body: <p>Just wondering if there's a way to set the default status for the entry listing pages in the admin, in my case from "All" to "Live". This would need to account for a page "refresh" and navigation using the sidebar links.</p>
  
  <p>I've tried to amend the <code>toolbar</code> property available in the passed context for the <code>cp.layouts.base</code> hook but this is purely visual and has no effect on the criteria to query for these entries.</p>
  
  <p>I've attached a screenshot to confirm location for anyone who's unsure. Many thanks in advance!</p>
  
  <p><a href="https://i.sstatic.net/wrA2j.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wrA2j.png" alt="enter image description here"></a></p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-22T13:37:02.453Z
Comments.Text: Thanks for this post and the suggested workaround. For anyone that wants to put their support behind a built-in feature for this, here's the feature request on Craft's repo: https://github.com/craftcms/cms/discussions/8926
Comments.UserDisplayName: Matt
Tags: <craft3><control-panel><admin>
Title: Set default status in CP admin for queried entries from "All" to "Live"
ThreadText: # Set default status in CP admin for queried entries from "All" to "Live"
  
  (Asked by: username_0 on 2020-06-01)
  
  Just wondering if there's a way to set the default status for the entry listing pages in the admin, in my case from "All" to "Live". This would need to account for a page "refresh" and navigation using the sidebar links.
  
  I've tried to amend the `toolbar` property available in the passed context for the `cp.layouts.base` hook but this is purely visual and has no effect on the criteria to query for these entries.
  
  I've attached a screenshot to confirm location for anyone who's unsure. Many thanks in advance!
  
  [![enter image description here](https://i.sstatic.net/wrA2j.png)](https://i.sstatic.net/wrA2j.png)
  
  **Tags:** craft3, control-panel, admin
  
  > **Comments:**
  > **username_1**: Thanks for this post and the suggested workaround. For anyone that wants to put their support behind a built-in feature for this, here's the feature request on Craft's repo: https://github.com/craftcms/cms/discussions/8926  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-06-05. Score: 1
  
  After a little head-scratching, the only way I could get this working was to register an AssetBundle (to load in my own JS), and making use of the Garnish toolkit as follows:
  
  ```
  $(document).ready(function() {
      var statusSet = false;
  
      Craft.elementIndex.on('updateElements selectSource', function(data) {
          if (!statusSet) {
              // Find the option (and make sure it actually exists)
              $option = data.target.statusMenu.$options.filter('a[data-status="live"]:first');
  
              if ($option.length) {
                  data.target.setStatus($option.data('status'))
                  statusSet = true;
              }
          }
      });
  });
  
  ```
  
  This should only trigger the `setStatus()` process once, even when navigating between sources (which will also be filtered to to the saved status state of "Live"), but allows the user the freedom to change the status again if they so choose.
  
  I hope this helps :)
  
  
  ---
  
  