gildas-lormeau/JSONVue

Automatically sorts by key

jameswlane opened this issue · 5 comments

The plugin automatically sorts the information by their key vs just showing how it is output.
I would think as a developer this shouldn't be default or a way to disable it.
I spend several hours today wondering why asort() wasn't working for my array and come to find out the plugin was sorting the output vs showing the exact output.

I am having same issue.

ISSUE: The JSON arrays are being "re-sorted" before being displayed.
SOLUTION: The items in an array should display in the order they are provided.

Ma-ve commented

Bump. This also had me baffled for several hours. Please look into this.

Agreed. Luckily I didn't spend too much time bashing my head trying to figure it out. This default behavior is a head scratcher because most developers need arrays in a particular order, so seeing it sorted differently than how I'm programming it to sort is odd.

Yes agreed, although it doesn't look like this project is active, sorting should be off by default. By all means provide the option to sort if you like, but we need to be confident the data has not been modified in any way by the plugin.

I had been back and forth with developers thinking they were applying a sort, but it turns out it was my results that were sorted! lol.

Edit: I had a peek at the code... not sure, but there are only two references to "sort". The culprit could be line 1081 in "WebContent\codemirror\codemirror.js". Just comment this bad boy out and then problem solved!

intact.sort(function(a, b) {return a.domStart - b.domStart;});

Any updates on this?
Is there any fork that resolved this?