This problem was first reported in 2006 on Bugzilla (https://bugzilla.wikimedia.org/show_bug.cgi?id=8028) but while the report was closed, it's still unresolved.
When tables only have "rowspan", sorting works well. When there is "colspan" it works only partially (for the columns before the "colspan"). And when both "colspan" and "rowspan" are present, it's basically impossible to sort anything.
Cf. the first tables of https://fr.wikipedia.org/wiki/Prix_Eisner on the French Wikipedia.