sorting-alpha-numeric

Questionssorting-alpha-numeric
Anthony Kam asked 4 months ago

Hi,

I have a list of course numbers to sort: 1, 12, 13, 13L, 1L, 2,3,4,5,6,8 (see screenshot) https://imgur.com/a/SJTGCRf

The correct sort order is : 1, 1L, 12,13, 13L, 2,3,4,…

How can I do this? any ideas?

Thanks.

1 Answers
Abu Ghufran Staff answered 3 months ago

If using mysql, You can try setting for that column (e.g. course_number). This way it will remove all characters and only use numeric while sorting.

$col["sortname"] = "CAST(course_number AS UNSIGNED)";
_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

13 + 11 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?