ExtJs容器中的SVG

时间:2015-03-09 13:47:40

标签: ajax extjs svg

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

有没有更好的方法来实现这一目标?任何意见/想法都会受到最高的赞赏。

1 个答案:

答案 0 :(得分:2)

嗯,总有更好的方法来做事。唯一的问题是,是否值得努力找出并实施。它对用户有用吗?用户完全满意吗?如果是的话,没有什么可以解决的。

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