I bet that your column type is a string like char, varchar, or text.
MySQL which I assume you are using does not support natural sorting on
these types. Convert "Reg No" to int and you will be able to sort
correctly!

Hope this helps,

James Fuller AKA jblotus
http://www.jblotus.com

On Dec 14, 12:52 am, joffin joy <[email protected]> wrote:
> Hi Sir/Madam,
>
> I have been working in cakePHP for some time and i have to say its very easy
> to build web based applications. But today i found out a strange issue in
> sorting of a page having pagination. As we click on the header it is sorted
> in both ASC and DESC order. But what the real issue is, i have a column
> named registration number with values 1,2,123001,123002 etc. But when we
> click on header to sort the column, it is sorted in order like
> 1,123001,123002,2 and not what should come ie 1,2,123001,123002. Same is the
> case of DESC order ie its showing order like 2,123002,123001,1 instead of
> 123002,123001,2,1. Hope this explanation is enough to understand whats my
> issue is?
>
> Some more code:
> View Page
>
> *<th><?php echo $paginator->sort('Reg No',
> 'Karayogam.karayogam_reg_no');?></th>*
>
> Controller side:
>
> *$this->set('listName', $this->paginate('ModelName', array($conditions)));*
>
> The screen shot is also attached. Please have a look.
>
> Waiting for a positive reply from your side.
>
> [image: EcommIT Microfinance Suite Karayogams_1292304661661.png]
>
> ----
> Joffin
>
> =======================================
> Imagination is more important than intelligence
> =======================================
>
>  EcommIT Microfinance Suite Karayogams_1292304661661.png
> 5KViewDownload

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to