Load grid row data into CodeMirror - get CodeMirro

2019-09-08 18:51发布

问题:

I am building a small extjs 5.1 app for personal use, designed to save examples of functions / methods used in my extjs apps.

I've given the most important steps with the help of Navaneeth-Kesavan and Tarabass in this Post

Now I'm struggling to load in CodeMirror editor the grid row data.

After several unsuccessful attempts, I am trying to load the data into a hidden textarea and then get value of this textarea and paste the value (setValue) in CodeMirror.

However, I am not able to get the CodeMirror reference.

I would appreciate suggestions to fix this.

By the way, what better way to do this?

MiFiddle

回答1:

CodeMirror element can be found as sibling of the textarea element. You can get reference to it by using the following code:

var codeMirrorInstance = textAreaComponent.getEl( ).query('.CodeMirror')[0].CodeMirror; 

Please refer below fiddle which I created by editing yours.

https://fiddle.sencha.com/#fiddle/tee