Editor Listing Page Sorting Issue

6 posts by 3 authors in: Forums > CMS Builder
Last Post: September 5, 2011   (RSS)

By 4cdg - September 1, 2011

I have a section that has almost 2000 records of real estate. On the editor listing page users can only see the records they create. I have setup several fields to be displayed on this page so users can sort and view info about each record. I have a price field which is a number only that is entered into a text field. When you click on the heading it changes the order from ascending then click again descending then click again default setting in sorting tab of section editor. I have it set to default to price+0 so it sorts numerically, but when you click to change order it sorts non numerically so say in descending order 99000 would be before 965000. Is there any way to make a column, when clicked, treat the data as numeric on this search so a 100,000 home would come before a 90,000 home in the sort?

Re: [4cdg] Editor Listing Page Sorting Issue

By Jason - September 2, 2011

Hi,

You're correct, the reason the sort isn't working when clicking on a column is that the price field is being stored as text in the MySQL database.

To change this to a number value, go into your section editor and modify your price field. Under "Advanced Options" you'll see a option for "Mysql Column Type". Enter in the word "float" and hit save. You should now be able to sort those columns properly.

NOTE: Before doing this, it is ALWAYS a good idea to do a backup of your database in case anything goes wrong.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Editor Listing Page Sorting Issue

By 4cdg - September 2, 2011

I get this error when trying to save after entereing float in the MySQL Column Type

There was an error changing the MySQL Column, the error was: Data truncated for column 'price' at row 87

Re: [4cdg] Editor Listing Page Sorting Issue

By Jason - September 2, 2011

Hi,

Okay, try changing the column from float to double. That should take care of the issue.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Editor Listing Page Sorting Issue

By 4cdg - September 2, 2011

same error message