Thoughts on development, design and the world we live in.

PostGres & MySQL Fixes For Drag Order Extension (for Radiant CMS)

By admin in Uncategorized. Posted on December 8th

We were experiencing an odd behavior with the very popular Drag Order extension. This extension allows you to re-order your pages in the Admin screen, and for that new order to be reflected in any loop on the front end, also via the children tag.

The aberrant behavior appears when you add a new page. If you try to drag and drop the page, the function re-numbers the list with duplicates.
take 3 pages:

Add a new page, 2.5. If you move it by drag and dropping to between 2 and 3, it will end up here:


If you look in the database, the position column, added by drag_order, on the Pages table, will have 2 “2″ positions.

This doesn’t occur in SqlLite; it does occur in MySQL and PostGres.

We installed PostGres, uninstalled Drag_Order (which involves some manual database dropping) and isolated the issue. We were unable to output to logger. Still trying to figure out that one. But we were able to run each statement in console, which is where we discovered the problem: the new page has a nil position value. When sorted, by the position, descending, the 2 databases in question consider Nil as a higher value and will float it to the top. After some other functions add and subtract position values to re-order siblings in the list, this value becomes “2″. Thus, a duplicate 2 in the list.

We changed the SQL to include a condition for no nulls. “:conditions => ” position is not null “. After re-testing, the lists were ordered correctly.

The fork for this fix is at: Banane fork of Radiant Drag Order on GitHub.

By admin | Posted in Uncategorized | Tagged , | Comments (1)

One Trackback

  1. By banane » Blog Archive » New to Open Source on December 8, 2009 at 3:12 pm

    [...] geeky posts I’ve written- on Blazing-Cloud, PostGres & MySQL Fixes for Drag Order Extension- Radiant CMS. Share and [...]

Post a Comment

Your email is never shared. Required fields are marked *