Page MenuHomePhabricator

Table sorter should support mixed strings and numbers in one column
Closed, ResolvedPublic


If table has string and integer in one wiki has problem with sorting.
specially up to down sorting

Version: 1.17.x
Severity: normal



Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 11:51 PM
bzimport set Reference to bz31137.
bzimport added a subscriber: Unknown Object (MLST).

In English table it has 4 type sorting 2 types string sorting and others are integer sorting but in Persian table it has only 2 type and that is string sorting

Krinkle (Since I think you did the sorting code), is this something that would have to be done upstream or could we add it?

The bug is on 1.17wmf1. The upcoming 1.18 has totally different sorting code that should fix this, by giving the user the option to define how the column should be sorted.

is it possible to save sorted table as new table?

Marking INVALID as 1.18 has a new sorting system which supports this.

(In reply to comment #4)

is it possible to save sorted table as new table?

No, but that's not related to this bug. Please ask on IRC or at the support desk:

@reza1615 Your tables don't use headers, and headers are required to add sorting. If it worked like that before 1.18, than we fixed a big bug in my opinion.

See also:

I added header but it doesn't work correctly
in both English and Farsi numbers the biggest number (102) is not sorted as biggest one.

That's because you are using it wrong. When you mix types, you need to tell it what type to use for sorting.


Oh, and for defining an order that is not yet predefined, you have to define your own collation algorithm: That will solve the issue of your farsi numbers ordering.

You might have to do this in MediaWiki:Common.js if you want it to work for all users.

i set like
mw.config.set('tableSorterCollation', {'۰':'0', '۱' : '1', '۲': '2', '۳':'3','۴':'4', '۵' : '5', '۶': '6', '۷':'7','۸':'8', '۹' : '9'});
but in mix table it doesn't recognize ۱ as number and ۲ (2 in English) is upper than ۱۱۱ (111 in English)
also i tested it in meta
it is the same as