nblgeoweb VIP
Total posts: 178
27 Jul 2016 15:22

I am using Cobalt 8.707 and I am using an upload field. The field is set to sort files by "Name A-Z" but it appears that is actually sorting by the filename on disk (filename in ##_js_res_files) instead of the real name (realname in ##js_res_files).

Last Modified: 28 Jul 2016


nblgeoweb VIP
Total posts: 178
27 Jul 2016 18:04

I've been tracking down the issue and it seems to be in library/php/fields/cobaltupload.php. I commented out natcasesort($sortArray) (around line 381) and the sorting works as expected now. Why is that there? That array_multisort call right below it seems to sort it fine without natcasesort.


Sergey
Total posts: 13,748
28 Jul 2016 04:48

nblgeoweb natcasesort

This is important part. If there are numbers in file name inatead of sorting liek this

  • 1
  • 10
  • 11
  • 2
  • 3

It will roder

  • 1
  • 2
  • 3
  • 10
  • 11

http://php.net/manual/en/function.natcasesort.php

Powered by Cobalt