我有一个页面,我在其中使用免费的 jqGrid 4.14.0 并将 serializeGridData 与 SOAP 请求一起使用。在 IE 11 中一切正常,但在 Edge 中,网格没有行,仅显示标题。我调试了页面,可以看到 SOAP 请求和响应都没有问题。任何人都可以提示我如何找出问题或解决此问题的方法。谢谢。
您需要解析的 XML 数据包含命名空间。您使用了转义字符串,如"rs\\:data"
和"z\\:row"
来解析数据。
xmlReader: {
root: "rs\\:data",
row: "z\\:row",
repeatitems: false,
id: "[ows_ID]"
}
在您的演示https://jsfiddle.net/psturm/rugr8tc0/ 中。这种方式并不安全,这取决于您使用的 jQuery 版本和您使用的 Web 浏览器的版本。我建议您使用自己的回调函数,它会获取所需的 XML 节点。例如,您可以使用
xmlReader: {
root: function (node) {
//return node.firstChild.firstChild.firstChild.firstChild.firstChild.firstChild;
return getChildNodesByName(
node.firstChild.firstChild.firstChild.firstChild.firstChild,
"rs:data")[0];
},
row: function (node) {
return getChildNodesByName(node, "z:row");
},
repeatitems: false,
id: "[ows_ID]"
}
其中函数getChildNodesByName
是
function getChildNodesByName (node, name) {
var items = [], children = node.childNodes, iChild, nChildren = children.length;
for (iChild = 0; iChild < nChildren; iChild++) {
child = children[iChild];
if (child.nodeType === 1 && child.nodeName === name) {
items.push(child);
}
}
return items;
}
由此产生的演示似乎适用于我计算机上安装的所有网络浏览器。查看修改后的演示https://jsfiddle.net/OlegKi/rugr8tc0/7/
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句