Closed hidegh closed 9 years ago
Until then there's a possibility to do a more complex sort via options:
sortField: [
{ field: "value", direction: "asc" },
{ field: "$score", direction: "desc" }
]
...but this is not a real solution, cause unnecessary sorting must be done on the client side...
I'm seeing a similar issue as well. The option at index 0 is being swapped with the option at index (options.length / 2) +1, the item just past the halfway mark. This only happens when there are more than 10 options in the list though. Setting the sortField options does get the list mostly in order but any items with diacritics aren't sorted correctly, which likely isn't a Selectize issue.
Sorting is a tough issue, it's better to leave it to the SQL or programming language, cause each culture has it's own specific character order. That's why currently the orderId attribute is the only real solution :D
Anyhow thanx for confirming that the same problem occurs elsewhere.
I'm going to refactor $order
sorting to not just be for options populated from the original DOM elements (coming soon).
Setting the sortField options does get the list mostly in order but any items with diacritics aren't sorted correctly, which likely isn't a Selectize issue.
This is fixed by the 0.4 release of Sifter.js, which will be used in the next release of selectize (coming in the next couple days)
Sorting is a tough issue, it's better to leave it to the SQL or programming language
Since the beginning, Selectize has been designed around client-side search and sorting for fast option selection. Using server ordering is possible, but it's going to be a hack. In the future we might have a preserveOrder
option that totally bypasses the sorting, but I can't say that's an immediate priority. It'll need to be done in a way that doesn't add a bunch more branches to the code than there already are.
i go the json (below) as a result from remote. order is by 'bezna znacka/common brand' then by 'nazov/name'.
got these options:
but somehow order is messed up, conrete: index 1 (not 0) is exchanged with an item from the middle.
of course i could generate also a sort id from code and sort by that id, but that would be non-professional.
see image and json:
{"ContentEncoding":null,"ContentType":null,"Data":[ {"Nazov":"ALFA ROMEO","BeznaZnacka":true},{"Nazov":"AUDI","BeznaZnacka":true},{"Nazov":"BMW","BeznaZnacka":true},{"Nazov":"CITROEN","BeznaZnacka":true},{"Nazov":"DACIA","BeznaZnacka":true},{"Nazov":"FIAT","BeznaZnacka":true},{"Nazov":"FORD","BeznaZnacka":true},{"Nazov":"HONDA","BeznaZnacka":true},{"Nazov":"HYUNDAI","BeznaZnacka":true},{"Nazov":"CHEVROLET","BeznaZnacka":true},{"Nazov":"KIA","BeznaZnacka":true},{"Nazov":"MAZDA","BeznaZnacka":true},{"Nazov":"MERCEDES","BeznaZnacka":true},{"Nazov":"MITSUBISHI","BeznaZnacka":true},{"Nazov":"NISSAN","BeznaZnacka":true},{"Nazov":"OPEL","BeznaZnacka":true},{"Nazov":"RENAULT","BeznaZnacka":true},{"Nazov":"SEAT","BeznaZnacka":true},{"Nazov":"SKODA","BeznaZnacka":true},{"Nazov":"SUBARU","BeznaZnacka":true},{"Nazov":"SUZUKI","BeznaZnacka":true},{"Nazov":"TOYOTA","BeznaZnacka":true},{"Nazov":"VOLKSWAGEN","BeznaZnacka":true},{"Nazov":"VOLVO","BeznaZnacka":true},{"Nazov":"ACKERMANN","BeznaZnacka":false},{"Nazov":"ANDORIA MOT","BeznaZnacka":false},{"Nazov":"ANDOVER","BeznaZnacka":false},{"Nazov":"ARO","BeznaZnacka":false},{"Nazov":"ASCA","BeznaZnacka":false},{"Nazov":"ASIA MOTORS","BeznaZnacka":false},{"Nazov":"ATM","BeznaZnacka":false},{"Nazov":"ATOKA","BeznaZnacka":false},{"Nazov":"AVIA","BeznaZnacka":false},{"Nazov":"BARTOLETTO","BeznaZnacka":false},{"Nazov":"BENALU","BeznaZnacka":false},{"Nazov":"BERGER","BeznaZnacka":false},{"Nazov":"BERTOJA","BeznaZnacka":false},{"Nazov":"BLUMHARDT","BeznaZnacka":false},{"Nazov":"BODEX","BeznaZnacka":false},{"Nazov":"BOS","BeznaZnacka":false},{"Nazov":"BRIAB","BeznaZnacka":false},{"Nazov":"BROSHUIS","BeznaZnacka":false},{"Nazov":"BRUCUS","BeznaZnacka":false},{"Nazov":"BSS","BeznaZnacka":false},{"Nazov":"BUCA","BeznaZnacka":false},{"Nazov":"BULTHUIS","BeznaZnacka":false},{"Nazov":"BURG","BeznaZnacka":false},{"Nazov":"CADILLAC","BeznaZnacka":false},{"Nazov":"CAMRO","BeznaZnacka":false},{"Nazov":"CARNEHEL","BeznaZnacka":false},{"Nazov":"CASTERA","BeznaZnacka":false},{"Nazov":"CLAAS","BeznaZnacka":false},{"Nazov":"CMT","BeznaZnacka":false},{"Nazov":"CODER","BeznaZnacka":false},{"Nazov":"COMETTO","BeznaZnacka":false},{"Nazov":"CONTAR","BeznaZnacka":false},{"Nazov":"CRAVEN TASKER","BeznaZnacka":false},{"Nazov":"CUPPERS","BeznaZnacka":false},{"Nazov":"DAEWOO","BeznaZnacka":false},{"Nazov":"DAF","BeznaZnacka":false},{"Nazov":"DAPA","BeznaZnacka":false},{"Nazov":"DESOT","BeznaZnacka":false},{"Nazov":"DNESTR","BeznaZnacka":false},{"Nazov":"DODGE","BeznaZnacka":false},{"Nazov":"DONBUR","BeznaZnacka":false},{"Nazov":"DORSEY","BeznaZnacka":false},{"Nazov":"DRACO","BeznaZnacka":false},{"Nazov":"DYNAVED","BeznaZnacka":false},{"Nazov":"EFFEDI","BeznaZnacka":false},{"Nazov":"EKERI","BeznaZnacka":false},{"Nazov":"EKW","BeznaZnacka":false},{"Nazov":"ESGE","BeznaZnacka":false},{"Nazov":"EVERLAST","BeznaZnacka":false},{"Nazov":"FAYNMONVILLE","BeznaZnacka":false},{"Nazov":"FLANDRIA","BeznaZnacka":false},{"Nazov":"FLIEGL","BeznaZnacka":false},{"Nazov":"FLOOR","BeznaZnacka":false},{"Nazov":"FOFFMANN","BeznaZnacka":false},{"Nazov":"FRAPPA","BeznaZnacka":false},{"Nazov":"FREJAT","BeznaZnacka":false},{"Nazov":"FRUEHAUF","BeznaZnacka":false},{"Nazov":"GAZ","BeznaZnacka":false},{"Nazov":"GENERAL-TRAILORS","BeznaZnacka":false},{"Nazov":"GHEYSEN","BeznaZnacka":false},{"Nazov":"GOLDHOFER","BeznaZnacka":false},{"Nazov":"GONTRAILER","BeznaZnacka":false},{"Nazov":"GORDON","BeznaZnacka":false},{"Nazov":"GRAG","BeznaZnacka":false},{"Nazov":"GRAYSADAMS","BeznaZnacka":false},{"Nazov":"GREAT DANE","BeznaZnacka":false},{"Nazov":"GROENEWEGEN","BeznaZnacka":false},{"Nazov":"GS","BeznaZnacka":false},{"Nazov":"HANGLER","BeznaZnacka":false},{"Nazov":"HENDRICKS","BeznaZnacka":false},{"Nazov":"HFR","BeznaZnacka":false},{"Nazov":"HONKER","BeznaZnacka":false},{"Nazov":"HUMMER","BeznaZnacka":false},{"Nazov":"CHALLENGER","BeznaZnacka":false},{"Nazov":"CHERAU","BeznaZnacka":false},{"Nazov":"CHRYSLER","BeznaZnacka":false},{"Nazov":"INÁ ZNAČKA","BeznaZnacka":false},{"Nazov":"INÉ","BeznaZnacka":false},{"Nazov":"ISUZU","BeznaZnacka":false},{"Nazov":"IVECO","BeznaZnacka":false},{"Nazov":"JAGUAR","BeznaZnacka":false},{"Nazov":"JEEP","BeznaZnacka":false},{"Nazov":"JOHN DEERE","BeznaZnacka":false},{"Nazov":"KAIPAN","BeznaZnacka":false},{"Nazov":"KOEGEL","BeznaZnacka":false},{"Nazov":"KRONE","BeznaZnacka":false},{"Nazov":"L.A.G","BeznaZnacka":false},{"Nazov":"LADA","BeznaZnacka":false},{"Nazov":"LAMBERET","BeznaZnacka":false},{"Nazov":"LANCIA","BeznaZnacka":false},{"Nazov":"LAND ROVER","BeznaZnacka":false},{"Nazov":"LDV","BeznaZnacka":false},{"Nazov":"LEXUS","BeznaZnacka":false},{"Nazov":"LIAZ","BeznaZnacka":false},{"Nazov":"LOHR","BeznaZnacka":false},{"Nazov":"MAGMA","BeznaZnacka":false},{"Nazov":"MAN","BeznaZnacka":false},{"Nazov":"MARUTI","BeznaZnacka":false},{"Nazov":"MASSEY FERGUSON","BeznaZnacka":false},{"Nazov":"MAYBACH","BeznaZnacka":false},{"Nazov":"MAZ","BeznaZnacka":false},{"Nazov":"MG","BeznaZnacka":false},{"Nazov":"MINI","BeznaZnacka":false},{"Nazov":"MITSUBISHI FUSO","BeznaZnacka":false},{"Nazov":"MOSKVIC","BeznaZnacka":false},{"Nazov":"MULTICAR","BeznaZnacka":false},{"Nazov":"NEW HOLLAND","BeznaZnacka":false},{"Nazov":"OLTCIT","BeznaZnacka":false},{"Nazov":"PACTON","BeznaZnacka":false},{"Nazov":"PEUGEOT","BeznaZnacka":false},{"Nazov":"PIAGGIO","BeznaZnacka":false},{"Nazov":"PONGRATZ","BeznaZnacka":false},{"Nazov":"PORSCHE","BeznaZnacka":false},{"Nazov":"PROTON","BeznaZnacka":false},{"Nazov":"ROVER","BeznaZnacka":false},{"Nazov":"SAAB","BeznaZnacka":false},{"Nazov":"SAMRO","BeznaZnacka":false},{"Nazov":"SANTANA","BeznaZnacka":false},{"Nazov":"SCAM","BeznaZnacka":false},{"Nazov":"SCANIA","BeznaZnacka":false},{"Nazov":"SCHMITZ","BeznaZnacka":false},{"Nazov":"SCHWARZMULLER","BeznaZnacka":false},{"Nazov":"SMART","BeznaZnacka":false},{"Nazov":"SSANGYONG","BeznaZnacka":false},{"Nazov":"STEYR","BeznaZnacka":false},{"Nazov":"TATA","BeznaZnacka":false},{"Nazov":"TATRA","BeznaZnacka":false},{"Nazov":"TAZ","BeznaZnacka":false},{"Nazov":"TRAILOR","BeznaZnacka":false},{"Nazov":"VAB","BeznaZnacka":false},{"Nazov":"VALTRA","BeznaZnacka":false},{"Nazov":"VANHOOL","BeznaZnacka":false},{"Nazov":"VOLGA","BeznaZnacka":false},{"Nazov":"YUGO","BeznaZnacka":false},{"Nazov":"YUKI","BeznaZnacka":false},{"Nazov":"ZETOR","BeznaZnacka":false}]," JsonRequestBehavior":1,"MaxJsonLength":null,"RecursionLimit":null}