ExtJs 容器内的 SVG

SVG inside ExtJs container

我正在 java 后端动态生成给定 XSD 的 class 层次结构,我想在 EXtJs 容器/ window.

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

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!');
        }
    });

有没有更好的方法来实现这个?任何输入/想法将不胜感激。

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

如果没有,请查看 Ext.draw.Container。您可以在那里创建 SVG 引擎,然后加载 svg 脚本,但是,不是完整的,只是绘图本身。