0

We use jqgrid to display data in a tabular view. When a column has upper and lower letters, the client side sorting shows the lower and upper letters in random order. Some lower case letters are showing first than the upper case letters, others show the upper case letters first. Please see the FirstName Column in the picture. Does anyone have experienced this same behavior and is there an explanation for this? Or what we have done wrong? We use JQGrid version 4.4.3. enter image description here

user981848
  • 295
  • 2
  • 4
  • 14

2 Answers2

2

You can use ignoreCase: true option to make local sorting case insensitive.

More recent version of jqGrid allows full customize sorting and searching/filtering (see the wiki article as the start point). New versions allow you to specify custom compare function for comparing items in the column. It allows to implement any custom sorting behavior. You use 5 years old jqGrid version 4.4.3, which is dead since a long time. I recommend you to upgrade to free jqGrid 4.15.2.

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Upgrading to a newer version is not an option for us at this moment. I also noticed that the sorting behaviors differently in IE than in chrome. We just want to see if there is a way to make it consistent and then we can document this behavior. – user981848 Jan 04 '18 at 23:11
  • @user981848: Has the usage of `ignoreCase: true` solved your main problem? About Upgrading. Even if you don't update your old application it could stop working on any new update of web browser. [The answer](https://stackoverflow.com/a/10621951/315935) describes the problem which exists in old jqGrid in version <4.3.3 in Chrome version 19 and higher. jqGrid rendered correctly in Chrome 18, but wrong in Chrome 19. Chrome makes update to new version every 1.5-2 months. Every ne version can break your old application, which uses 4.4.3. Nobody will fix the problem in the old version. It's real risk – Oleg Jan 05 '18 at 13:22
  • @user981848: The only way to fix the problem described in [the answer](https://stackoverflow.com/a/10621951/315935) was updating jqGrid code. I'll fix a problem in new version of free jqGrid, which I develop, for example in 4.15.4. To calculate the risk and to calculate the upgrade time I'd recommend you **to test** the current version of free jqGrid: 4.15.2. I tried to hold free jqGrid maximally compatible with old versions and you will probably need to add only some options, which default values were changed because of security reasons, for example. – Oleg Jan 05 '18 at 13:32
  • @user981848: You need just temporary modify URL, from which you load `ui.jqgrid.css`, `jquery.jqgrid.min.js` and `grid.locale-en.js`. You can load the files directly from CDN. See [the wiki article](https://github.com/free-jqgrid/jqGrid/wiki/Access-free-jqGrid-from-different-CDNs). Free jqGrid can be used completely free of charge. Thus I have no interest that you or your company upgrade to free jqGrid. It's just my suggestion to you because holding so old, dead version is really risky. – Oleg Jan 05 '18 at 13:34
0

Just to give a conclusion on this post. I changed ignoreCase's value form true to false. When this flag is false, the grid sorts the values based on their Unicode. The sorted result is consistent each time when user clicks to sort. However, the sorting of the foreign characters (such as characters with accents) do not match the popular sorting behavior. Achieving a consistent sorting result is good enough for the coming release if our product. We will look into upgrading the jqGrid to newer version in the future. Thanks @Oleg for your help.

user981848
  • 295
  • 2
  • 4
  • 14