R
R
Roman Rakzin2015-07-09 19:30:26
htaccess
Roman Rakzin, 2015-07-09 19:30:26

Wrong sorting in javascript?

Good afternoon, there is an array with the names:
Petrov, Ivanov, User 1, User 2 ... User 11 ... User 21 ...
For some reason, when I sort (using angular, by the way, and not only - I got the same answer) - I get the answer
Ivanov
Petrov
Sidorov
User 1
User 11
User 2
User 22
...
I don’t understand what kind of sorting is so clumsy? (User 11 should be after User 2 and in general after Petrov ... well, t .d.)
How to make it sorted like normal people? )))

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Viktor Taran, 2018-11-08
@vc4vc

It's simple, you need to add exceptions to the CNC, I will show the Bitrix example, the sign is NOT!

RewriteCond %{REQUEST_FILENAME} !-f                                               #  если это не файл
  RewriteCond %{REQUEST_FILENAME} !-l                                               #  и если это не линка
  RewriteCond %{REQUEST_FILENAME} !-d                                              #  и если это не директорие ( то есть по сути любые физические файлы и  каталоги)
  RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$             #  и внимание если это этот файл !  в данном случае  чтб небыло цикла. 
  RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]                                           # То перенаправить все запросы туда

And so you will need to add cond with conditions if it is physical files and directories.
If not, then you need to use not %{REQUEST_FILENAME} but %{REQUEST_URI} , but if there are also GET parameters in the url, the construction will increase even more.
In general, end urls are needed. ;)

M
Maxim E, 2018-11-08
@creativeworm

Submit the contents of .htaccess. Strings

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
should check for the presence of folders and files, but you can do something likeRewriteCond %{REQUEST_URI} !^/(magazine) [NC]

I
Ilya Shatokhin, 2015-07-09
@iShatokhin

Use the "natural" sorting algorithm.
Here is the finished solution

A
Alexander Taratin, 2015-07-09
@Taraflex

Everything is logical. You are sorting the rows. So it was always and everywhere.
Pay attention to the sort order of files in the OS for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question