简体   繁体   English

jsTree 使用的 xml_data 插件在 IE9 中不工作?

[英]xml_data plugin used by jsTree not working in IE9?

I am trying to use the JsTree plugin to display the hierarchial tree.我正在尝试使用 JsTree 插件来显示层次结构树。 Right now the tree is rendered properly only on Firefox browser, doesnot work in IE 8 or 9 or any other browser we tested.现在树仅在 Firefox 浏览器上正确呈现,在 IE 8 或 9 或我们测试的任何其他浏览器中不起作用。 I am using the XML format of data internally and recently found the xml_data plugin is not recognized by IE9..我在内部使用 XML 格式的数据,最近发现 xml_data 插件无法被 IE9 识别。

The other option is to use JSON to render the data, so wanted to know if it should work fine with JSON, if yes, is there a way I can convert the XML data directly to JSON format somehow?另一种选择是使用 JSON 来呈现数据,所以想知道它是否可以与 JSON 一起正常工作,如果可以,有没有办法可以将 XML 数据以某种方式直接转换为 JSON 格式?

Thanks in advance,提前致谢,

Use dataType = text instead of xml in ajax call your problem will solved:)在 ajax 调用中使用 dataType = text 而不是 xml 你的问题就会解决:)

My Employees_xml_flat.xml file contains is as follows: you can add more nodes if you want我的Employees_xml_flat.xml文件包含如下:您可以根据需要添加更多节点

<item id="19001" parent_id="0"   >  
            <content><name>Vaibhav</name></content>                
        </item>  
        <item id="19002" parent_id="19003"   >    
      <content><name>Pri_dev</name></content> 
      </item>

See following sample code: This jsTree will work fine on IE, Mozila and Google chrome.请参阅以下示例代码:此 jsTree 可以在 IE、Mozila 和 Google chrome 上正常工作。 Not tested on other browser未在其他浏览器上测试

Use jsTree使用 jsTree

    $(document).ready(function(){
        $.ajax({
            type: "GET",
            url: "Employees_xml_flat.xml",
            dataType: "text",
            success: function(xmlData) {
                $("#treeViewDiv").jstree({
                    "xml_data" : {
                        "data" : xmlData
                    },
                    "plugins" : [ "themes", "xml_data" ]
                });
            }
        });
    });

</script>
</head>
<body>
    <div id="treeViewDiv"></div>
</body>
</html>

We've used jquery.xml2json and it worked great as long as the XML passed in is valid.我们使用了 jquery.xml2json,只要传入的 XML 有效,它就可以正常工作。

http://www.fyneworks.com/jquery/xml-to-json/ http://www.fyneworks.com/jquery/xml-to-json/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM