Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ajax ExtJs容器中的SVG_Ajax_Extjs_Svg - Fatal编程技术网

Ajax ExtJs容器中的SVG

Ajax ExtJs容器中的SVG,ajax,extjs,svg,Ajax,Extjs,Svg,我正在java后端中动态生成给定XSD的类层次结构,并希望在EXtJs容器/窗口中显示该SVG 现在,我正在做这样的事情- Ext.Ajax.request({ url : 'schemacontroller/schemadiagram.do', method: 'GET', success : function(response){ //console.log(response.responseText);

我正在java后端中动态生成给定XSD的类层次结构,并希望在EXtJs容器/窗口中显示该SVG

现在,我正在做这样的事情-

Ext.Ajax.request({
        url : 'schemacontroller/schemadiagram.do',
        method: 'GET',
        success : function(response){
            //console.log(response.responseText);
            var w = window.open("","Schema Diagram","left=0px,top=0px,resizable=yes,scrollbars=yes");
            w.document.body.scroll = "auto";
            w.document.write(response.responseText); // responseText contains the whole of the SVG scripts along with the html generated
        },
        failure : function(response){
            Ext.MessageBox.alert('Error','Failed to load the schema diagram!');
        }
    });

有没有更好的方法来实现这一点?任何意见/想法都将不胜感激。

嗯,做事总是有更好的方法。唯一的问题是,这是否值得努力去发现和实施。它对用户有用吗?用户是否完全满意?如果是的话,就没什么好解决的了


如果没有,那么看一看。您可以在那里创建SVG引擎,然后加载SVG脚本,但不是全部,只是加载图形本身。

url目前不起作用-需要更新到正确的url。如果脚本包含和CDATA,此解决方案将不起作用。请参阅控制台输出。SVG内容必须通过https提供。最好是在fiddle之外测试它。当你第一次打开fiddle时,你必须允许混合的安全内容(如果你使用chrome,通常单击地址栏中的屏蔽图标)。