<p><code>fixedOrder</code> only works with the <code>id</code> param. (If <code>fixedOrder</code> is <code>true</code> <em>and</em> <code>id</code> is set to a list of IDs, it will return the elements in the exact order that the IDs were listed.) It’s currently not possible to query elements in a fixed order based on any other params.</p>

<p>For your use case, the <a href="https://craftcms.com/docs/templating/filters#group" rel="nofollow">|group</a> filter should work nicely:</p>

<pre><code>{% set kinds = ['pdf', 'word', 'excel'] %}
{% set filesByKind = craft.assets.kind(kinds)|group('kind') %}

&lt;section class="bestanden"&gt;
    &lt;div class="col-12-md"&gt;
        &lt;div class="documenten"&gt;
            &lt;ul&gt;
                {# Loop through the file kinds in the order we want #}
                {% for kind in kinds %}
                    {% for file in filesByKind[kind] %}
                        &lt;li&gt;
                           &lt;i class="fa fa-file-{{ kind }}-o"&gt;&lt;/i&gt; &lt;a href="{{ file.url }}" target="_blank"&gt;{{ file }}&lt;/a&gt;
                        &lt;/li&gt;
                    {% endfor %}
                {% endfor %}
            &lt;/ul&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;
</code></pre>

CC BY-SA 3.0
2016-10-18T16:41:04.613Z
2016-10-18T16:41:04.613Z
Brandon Kelly
<p>I thought that a simple <code>.fixedOrder(true)</code> would make the files order in the same way as in the CMS. Instead of that, there is no output. Where I go wrong?</p>

<pre><code>{% set files = craft.assets.kind('pdf,word,excel').fixedOrder(true) %}
&lt;section class="bestanden"&gt;
    &lt;div class="col-12-md"&gt;
        &lt;div class="documenten"&gt;
            &lt;ul&gt;
                {% for file in files %}
                &lt;li&gt;
                   &lt;i class="fa fa-file-{{ file.kind }}-o"&gt;&lt;/i&gt; &lt;a href="{{ file.url }}" target="_blank"&gt;{{ file }}&lt;/a&gt;
                &lt;/li&gt;
                {% endfor %}
            &lt;/ul&gt;

        &lt;/div&gt;
    &lt;/div&gt;
&lt;/section&gt;
</code></pre>

<assets>
fixedOrder(true) not working?
# fixedOrder(true) not working?

(Asked by: username_0 on 2016-10-18)

I thought that a simple .fixedOrder(true) would make the files order in the same way as in the CMS. Instead of that, there is no output. Where I go wrong?
{% set files = craft.assets.kind('pdf,word,excel').fixedOrder(true) %}

    
        
            
                {% for file in files %}
                
                    {{ file }}
                
                {% endfor %}

**Tags:** assets

---

## 1 answers

### Answer by username_1 on 2016-10-18. Score: 4

fixedOrder only works with the id param. (If fixedOrder is true and id is set to a list of IDs, it will return the elements in the exact order that the IDs were listed.) It’s currently not possible to query elements in a fixed order based on any other params.
For your use case, the |group filter should work nicely:
{% set kinds = ['pdf', 'word', 'excel'] %}
{% set filesByKind = craft.assets.kind(kinds)|group('kind') %}


    
        
            
                {# Loop through the file kinds in the order we want #}
                {% for kind in kinds %}
                    {% for file in filesByKind[kind] %}
                        
                            {{ file }}
                        
                    {% endfor %}
                {% endfor %}


---

