I'm trying to sort a view by a text field. The text field include numbers, in general.

While sorting it sorts as below:

  • 1
  • 10
  • 11
  • 2
  • 20
  • ...

But I want to make the sorting natural.

The Views Natural Sort module doesn't work, it only works with the Title field, unfortunately (there was some options to sort text fields before but now there isn't any option for this).

How can I natural sort the view by text field? And use the table sort asc/sort desc feature?

(The field should be text field and couldn't be an integer field.)

  • If your field uses numbers only, then you need to use an integer field, and not a text field.
    – No Sssweat
    Nov 8, 2015 at 7:49
  • @NoSssweat, as I said in the question it couldn't be an integer field because in some cases it can include "dashes" (3-4 etc.)
    – herci
    Nov 8, 2015 at 8:06
  • The views natural sort module you linked to has a 2.x version that supports other fields. It is still in alpha but there are over 200 sites that report using 2.x versions so it is possibly stable enough to use.
    – rooby
    Nov 8, 2015 at 12:32
  • @rooby, Thanks but it doesn't work as expected. It gives a lot of different errors.
    – herci
    Nov 14, 2015 at 8:10

2 Answers 2


As per Views Natural Sort module homepage, you should enable Enable Views Natural Sort Text Field support to make the text fields sortable.

Here are the steps:

  1. Enable Views Natural Sort.
  2. Also Enable Views Natural Sort Text Field support (this will most likely go away in the future)
  3. Navigate to the fields edit page for the field that you wish to enable 1. Natural Sorting on and check "Enable natural sorting." http://screencast.com/t/eDkW0c6AC This is needed so that we aren't indexing other text fields needlessly bloating the sorting table. In the future there may be a separate table for each field, I'll have to do some performance testing.
  4. When you do that, your fields "Should" be reindexed... at that time. You should be taken to a batch operations screen.
  5. Next you can go to the view you are editing and the option to sort the view naturally should be there. http://screencast.com/t/6XD7oeBtl

Note: When working with fields there is the need to enable fields for indexing. At the point the setting is enabled, the field is indexed and will be ready for use in a view. Follow the following steps to allow natural sorting on text fields:


I had numbered title fields I wanted sorted naturally (1,2,3,4,5,6,10,11,20,21,30). Views natural sort did not work for me. Sorting was all messed up. What finally worked for me was to uninstall views natural sort and simply put "order by lpad(name, 10, 0)" in the database comment field of the view.

  • I assume you filed an issue with the problem? The maintainer may be able to help with problems like these for you and others. Jan 7, 2018 at 2:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.