The object is parsed from JSON, so it is not possible for me to use numeric keys directly.
I expected that the options would be sorted from highest numeric values to lowest numeric values in the dropdown of the create.and edit forms. However, this is not the case. The options get sorted by value (so 1, 5, 7, etc.), but the values are treated as string values. Instead of a numerically descending order, the options are sorted in the lexicographic order, resulting in:
99, 98, 97, 96, 16, 15, 13, 103, 102, ...
jTable: 2.5.0
I have a field with options like to:
The object is parsed from JSON, so it is not possible for me to use numeric keys directly.
I expected that the options would be sorted from highest numeric values to lowest numeric values in the dropdown of the create.and edit forms. However, this is not the case. The options get sorted by value (so 1, 5, 7, etc.), but the values are treated as string values. Instead of a numerically descending order, the options are sorted in the lexicographic order, resulting in: 99, 98, 97, 96, 16, 15, 13, 103, 102, ...
After some research of the jTable source code, i found that the type check of the value done in https://github.com/volosoft/jtable/blob/master/jquery.jtable.js#L955 is not respecting numeric values in quotes as such. So I changed
to
This seems to work, even if the keys of the object are numeric values in quotes.