PDA

View Full Version : ExtJS equivalent of jQuery.html(..)



cjauvin
13 Nov 2012, 10:11 AM
I need the functionality performed by the setter version of jQuery.html, as described here:

http://stackoverflow.com/a/5390626/787842

i.e. I want the JS code contained in the HTML fragment to be executed upon insertion. As the bare elem.innerHTML does not work the same, I've been trying to find an ExtJS equivalent, but it seems that the closest I could find, elem.insertHTML, also does not work in the same way (i.e. the code does not get executed).

greg.barry
14 Nov 2012, 5:00 PM
Can you explain what it is you are trying to accomplish by doing this? I have to believe that there is a better way of accomplishing your goal without inserting and executing raw javascript into a component.

cjauvin
15 Nov 2012, 6:22 AM
I was expecting such a question, to be sure. What I'm trying to do is redirect, in a popup "Ext.Window", the content of a dynamic debug console (http://flask.pocoo.org/docs/quickstart/#debug-mode) spawned by a Flask Python dev server. If I bind this redirection to the "exception" and "failure" callback handlers of my widgets, I can inspect and interact readily with my backend code, directly in the UI of my app (without any reloading) whenever an exception occurs. This is quite handy.

I studied the question rather thoroughly, and found that the "jQuery.html" behaviour (using "domManip") is needed to correctly display and execute the JS code snippet that is embedded in the code returned by the debug console. It works, but I was curious to know if I could come up with a 100% ExtJS solution, without resorting to jQuery.