File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -65,10 +65,11 @@ public function run()
65
65
private function registerAssets ()
66
66
{
67
67
$ ajaxUrl = Url::to ($ this ->ajaxUrl );
68
- $ jsonEditorContainerId = Html::getInputId ($ this ->model , $ this ->jsonEditorAttribute ) . '-container ' ;
68
+ $ jsonEditorInputId = Html::getInputId ($ this ->model , $ this ->jsonEditorAttribute );
69
+ $ jsonEditorContainerId = $ jsonEditorInputId . '-container ' ;
69
70
$ select2Id = Html::getInputId ($ this ->model , $ this ->attribute );
70
71
$ jsonEditorOptions = json_encode ($ this ->jsonEditorOptions );
71
-
72
+
72
73
$ this ->view ->registerJs (<<<JS
73
74
$("# {$ select2Id }").on("select2:select", function () {
74
75
var value = $(this).val();
@@ -89,6 +90,10 @@ private function registerAssets()
89
90
90
91
jsonEditors[index].destroy();
91
92
jsonEditors[index] = new JSONEditor(document.getElementById(" {$ jsonEditorContainerId }"), jsonEditorOptions)
93
+
94
+ jsonEditors[index].on("change", function () {
95
+ document.getElementById(" {$ jsonEditorInputId }").value = JSON.stringify(this.getValue());
96
+ })
92
97
}
93
98
})
94
99
});
You can’t perform that action at this time.
0 commit comments