Custom sorting with DraggableViews (Drupal)


When sorting on date or name isn’t granular enough, you can use DraggableViews which allows custom reordening. DraggableViews uses the handles we know from the back-end of Drupal, for example when we want to change the ordening of menu-items. 

In order to use DraggableViews, you need the Draggable Views module and the dependencies Chaos tools, Views and Entity API. 

Create a View for the end user

In this example we create a Page of Articles. The Page could also be a Block and the Fields could also be Content. 


Create a Block next to the Page

Give it a clear name to separate it from the front-end content, for example ‘Draggable’ or ‘Ordering’. Follow these steps: 

Format: table (For: this block)

Add a Field: Draggableviews: Content (For: this block) and check ‘Ajax’ 

Add a Sort: Draggableviews: Weight (asc) (For: all displays) 


Make the Block visible on the Page

Now, go to the Structure > Blocks interface and look for the ‘Draggable block’. Make sure it is under the main content block and choose to show the block only on the page of the View, in this case articles. 


Flush the caches to be sure it works. After reordering the articles, click Save and Refresh the page. 


Add some access controls

In most cases: we want the Draggable Views block to be only visible for content editors and not for anonymous users. 

Go to the Draggable Views block settings (under Structure > Blocks) and check the Roles vertical tab. Show the block only to the roles of your choice. Test with this role and with an anonymous user. If this ain't working, set the permission at the Views level by choosing Access and limit the View to the roles of your choice. 



Thank you so much, some how it never occurred to me to place the sorting block, because when you create it as a view page, you can access the sort view from the gear ... the amount of time wasted in Drupal on stupid things you overlooked!

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.