Easily sort your element index tables on custom fields
The Customizable Element Index (CEI) feature in Craft 2.5+ lets users show or hide any custom field and/or metadata to the element indexes (i.e. the table listing your Entries, Categories, Assets or Users). Awesome stuff! Unfortunately though, Craft won't actually let you sort elements on the columns you add – unless you add also add corresponding values to the sortable attributes in a custom plugin. Even then, there are issues, such as the sort menu not being source aware (meaning all custom, sortable attributes added via the
modifyEntrySortableAttributes hook will display for all Sections), custom columns' headers are not clickable etc.
CP Sortable Custom Columns is a tiny plugin with a heavy handed name, aiming to hotfix the above issues.
- Automatically include any (sortable) custom field or meta value added to an element index in the sort menu
- Works with attributes added via the CEI interface or in plugin hooks (such as
- Makes the headers for custom, sortable columns clickable, for easy sorting
- Makes the sorting menu source aware – any column not in the current source's element index table will be removed from the sorting menu
With this plugin installed, any (sortable) custom field or meta value you add to an element index (either via hooks in a plugin, or via the CEI interface) will automatically be available for sorting.
So which FieldTypes are sortable?
Any FieldType (custom or built-in) of the following attribute types are sortable:
Additionally, CP Sortable Custom Columns adds support for sorting on pretty much any meta field, such as Entry Type, Author, Updated Date etc.
CP Sortable Custom Columns requires Craft 2.5 or newer.
- Download and unzip
- Move the
/cpsortcolsfolder to your
- Install from the Control Panel (
Disclaimer, bugs, feature request, support etc.
This plugin is provided free of charge and you can do whatever you want with it. CP Sortable Custom Columns is unlikely to mess up your stuff, but just to be clear: the author is not responsible for data loss or any other problems resulting from the use of this plugin.
Please report any bugs, feature requests or other issues here. Note that this is a hobby project and no promises are made regarding response time, feature implementations or bug fixes.
Pull requests are extremely welcome
- [Fixed] Fixes issue where CP Sortable Custom Columns would leak configuration data on login screen
- [Fixed] Fixes issue w/ sorting in Commerce active/inactive carts view (thanks @engram-design)
- [Fixed] Now works like it should for User element indexes.
- [Added] Adds support for Commerce Orders and Products (thanks Marion Newlevant!)
- [Fixed] Fixes an issue with Entry Type sorting
- [Improved] Now displays loading spinners for custom columns
- Fixes an issue with deactivated/uninstalled FieldTypes (thanks @carlcs, you're a champ!)
- Initial public release