Fixed index of Array items not being updated after sorting
This commit is contained in:
parent
9a77045e78
commit
358ef3086c
|
@ -3,6 +3,11 @@
|
||||||
https://github.com/josdejong/jsoneditor
|
https://github.com/josdejong/jsoneditor
|
||||||
|
|
||||||
|
|
||||||
|
## not yet released, version 5.15.1
|
||||||
|
|
||||||
|
- Fixed index numbers of Array itesm not being updated after sorting.
|
||||||
|
|
||||||
|
|
||||||
## 2018-05-02, version 5.15.0
|
## 2018-05-02, version 5.15.0
|
||||||
|
|
||||||
- Implemented selection API: `onSelectionChanged`, `onTextSelectionChanged`,
|
- Implemented selection API: `onSelectionChanged`, `onTextSelectionChanged`,
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"bugs": "https://github.com/josdejong/jsoneditor/issues",
|
"bugs": "https://github.com/josdejong/jsoneditor/issues",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "gulp",
|
"build": "gulp",
|
||||||
"watch": "gulp watch",
|
"start": "gulp watch",
|
||||||
"test": "mocha test"
|
"test": "mocha test"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -3003,6 +3003,14 @@ Node.prototype.sort = function (direction) {
|
||||||
});
|
});
|
||||||
this.sortOrder = (order == 1) ? 'asc' : 'desc';
|
this.sortOrder = (order == 1) ? 'asc' : 'desc';
|
||||||
|
|
||||||
|
// update the index numbering
|
||||||
|
if (this.type === 'array') {
|
||||||
|
this.childs.forEach(function (child, index) {
|
||||||
|
child.index = index;
|
||||||
|
child.updateDom();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
this.editor._onAction('sort', {
|
this.editor._onAction('sort', {
|
||||||
node: this,
|
node: this,
|
||||||
oldChilds: oldChilds,
|
oldChilds: oldChilds,
|
||||||
|
|
Loading…
Reference in New Issue