Jqgrid sorts numbers as strings.

when the ID column format in the database is string,
and sorted using jqGrid, the sort by ID becomes the sorting mode of the following figure,

Baidu did not find a suitable solution for a while.

Mar.01,2021

adding sorttype:'integer' sorting to colModel makes it normal


this is the string sorting problem. Use sort ((a, b) = > a-b) to implicitly convert to numeric comparison to try sorting

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4bcee-44e61.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4bcee-44e61.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?