Last modified: 2012-04-23 09:14:21 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T37523, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35523 - data-sort-value in broadtable-fields doesn't consider "," as decimal separator
data-sort-value in broadtable-fields doesn't consider "," as decimal separator
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Unprioritized major (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-27 16:04 UTC by Christian Illy
Modified: 2012-04-23 09:14 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Christian Illy 2012-03-27 16:04:05 UTC
If you have an ask statement which outputs a sortable table SMW adds "data-sort-value"-attributes to the table cells. Unfortunately SMW itself recognizes the "," in our properties as decimal separator but when passing the value to the HTML-attribute it prints the decimal separator as ".". So a value of "4,2" in an property is passed as "4.2" to the "data-sort-value"-attribute.

Now when using MW's JavaScript sort function it interprets the "." as "thousand separator" (as it is in German) so it just ignores it which makes it interpret the "4.2" as "42" and the resulting sorting is wrong.

Therefore SMW should use the correct locale when printing out the column value to the "data-sort-value"-attribute.

Regards,
Chris
Comment 1 Christian Illy 2012-04-02 10:05:39 UTC
Interesting sitenote: When we had 1.7.1 installed from snapshot from MediaWiki-Extensions page ( SemanticMediaWiki-MW1.18-r92435.tar ) sorting worked. Unfortunately this gave a whole lot of differences.
1. It said version "1.6 RC1" in Special:Version
2. The table output of SMW looked quite different in regards to styling
3. Boolean values were saved as "True" and "False" by using Semantic Forms (without having changed anything in regards to (SM Forms)

*As far as I remember* the data-sort-value was also set to 4.2 for decimal values, so I whonder why it now doesn't work anymore (see below).


Now having installed 1.7.1 from the SMW-Website (Help:Download) nr. 1 is fixed (it shows 1.7.1 now), nr. 2 is also back to what it was before switching to the r92435 snapshot, nr. 3 also (it saves the german words "Ja" and "Nein"). But now sorting again doesn't work, it still stores 4.2 as the "data-sort-value"-attribute and it is treated as 42.

Any hints? Is that related to SMW, MW, some setting or what?

Regards,
Chris
Comment 2 Christian Illy 2012-04-22 13:12:24 UTC
How's the probability that this is going to be fixed?

Regards,
Chris
Comment 3 Jeroen De Dauw 2012-04-22 13:24:14 UTC
Recent versions of SMW have been using MediaWikis own table sort mechanism. If the sort issue is coming from there, then you should file a bug for that component. Can you link a page with both the working and broken variants so I can have a quick look at what's going wrong?
Comment 4 Christian Illy 2012-04-22 21:15:27 UTC
Hi Jeroen,

unfortunately I can only give you a link to the non working variant as one wiki can only have one copy of SMW active ;)
This one would be: http://www.taschenlampen-wiki.de/index.php/Alle_Lampen
If you sort e.g. by LZ@Min you get an almost correct sorting but e.g. "0,7 h" is sorted in between "4 h" and "8 h", simply ignoring the decimal separator ",". Same for e.g. "1,5 h" treated as 15.

Regards,
Chris

PS: I simply don't know if this is a problem with SMW oder MW, but as the r92435-Version had correct sorting I thought this is a SMW problem. Or was that one using it's own sorter?
Comment 5 Markus Krötzsch 2012-04-23 09:14:21 UTC
This bug might be related to the MediaWiki version that is used. SMW uses the MW sorting script. Values should be sorted by there data-sort-value attribute in HTML, i.e., it should not matter at all what is shown in the table cell as long as the sort value is correct.

The sort values set by SMW seem to be correct, e.g.,

 <td data-sort-value="1.2" class="LZ@Max">1,2&#160;h</td>

However, the sort script seems to ignore those values. The error must be sought in the Javascript: Is it just a bug that is corrected in newer MW versions? Is the sort script changed/overwritten by some extension? Did MW change the script on purpose and SMW needs to use a different way for setting the sort value?

When experimenting with this, it has to be kept in mind that browsers tend to cache such scripts, so changes in configuration/software version may not be instantaneous.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links