Skip to content

Commit 9187c5f

Browse files
committed
fixed jsonEditor init after json-editor/json-editor@58715dd
1 parent 07af4f0 commit 9187c5f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

assets/backend/page-route-items.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ $(function () {
88

99
$(document).on('change', 'select[name="Tree[route]"]', function () {
1010
var self = $(this);
11-
1211
$.post(self.data('request-url'), {value: self.val()}, function (resp, status) {
1312
if (status === 'success') {
1413
var schema = resp.schema;
@@ -27,13 +26,14 @@ $(function () {
2726
// recreate Editor
2827
editor.destroy();
2928
jsonEditorList[editorIndex] = new JSONEditor(element, editorOptions);
30-
31-
// inital update of value
32-
$('input[name="Tree[request_params]"]').val(JSON.stringify(jsonEditorList[editorIndex].getValue()));
33-
34-
// update/init change callback for newly inserted editor which update the input value
35-
jsonEditorList[editorIndex].on('change', function () {
29+
jsonEditorList[editorIndex].on('ready', function () {
30+
// inital update of value
3631
$('input[name="Tree[request_params]"]').val(JSON.stringify(jsonEditorList[editorIndex].getValue()));
32+
33+
// update/init change callback for newly inserted editor which update the input value
34+
jsonEditorList[editorIndex].on('change', function () {
35+
$('input[name="Tree[request_params]"]').val(JSON.stringify(jsonEditorList[editorIndex].getValue()));
36+
});
3737
});
3838

3939
} else {

0 commit comments

Comments
 (0)