<p>As far as I'm aware, there is currently no native way to do this without using an ElementType index page. </p>

<p>You have two options for implementing this yourself. One is to sort the table on user input with the help of the <a href="http://buildwithcraft.com/docs/plugins/hooks-reference#registerCpRoutes" rel="nofollow noreferrer">registerCpRoutes hook</a> (with AJAX or by reloading the page). The other is to use a JavaScript solution, as discussed in <a href="https://craftcms.stackexchange.com/questions/2821/filtering-and-sorting-lists-in-a-plugin">this question</a>.</p>

CC BY-SA 3.0
2015-01-04T19:33:21.743Z
2015-01-04T19:33:21.743Z
2017-04-13T12:51:00.200Z
Ben Croker
<p>I know that if i have created a new ElementType for my plugin that I can use the same template that Entries uses:</p>

<pre><code>{% extends "_layouts/elementindex" %}
{% set title = "Entries"|t %}
{% set elementType = 'Entry' %}
</code></pre>

<p>and that will give me the standard layout with a sortable table.</p>

<p>However is there anyway to tap into the sortable stuff for my own custom table in my plugin.</p>

<p>Or is it simply a case of having to work the sortable stuff myself (which is fine)? I just thought I would ask as I would prefer to use the native stuff if it is easy to hook into.</p>

<control-panel><sorting><admin>
Easiest way to make a table in the Control Panel sortable?
# Easiest way to make a table in the Control Panel sortable?

(Asked by: username_0 on 2014-08-08)

I know that if i have created a new ElementType for my plugin that I can use the same template that Entries uses:
{% extends "_layouts/elementindex" %}
{% set title = "Entries"|t %}
{% set elementType = 'Entry' %}

and that will give me the standard layout with a sortable table.
However is there anyway to tap into the sortable stuff for my own custom table in my plugin.
Or is it simply a case of having to work the sortable stuff myself (which is fine)? I just thought I would ask as I would prefer to use the native stuff if it is easy to hook into.

**Tags:** control-panel, sorting, admin

---

## 1 answers

### Answer by username_1 on 2015-01-04. Score: 2

As far as I'm aware, there is currently no native way to do this without using an ElementType index page.

You have two options for implementing this yourself. One is to sort the table on user input with the help of the [registerCpRoutes hook](http://buildwithcraft.com/docs/plugins/hooks-reference#registerCpRoutes) (with AJAX or by reloading the page). The other is to use a JavaScript solution, as discussed in [this question](https://craftcms.stackexchange.com/questions/2821/filtering-and-sorting-lists-in-a-plugin).


---

