jqgrid在Edge浏览器中没有行
jqgrid no rows in Edge browser
我有一个页面,我在其中使用免费的 jqGrid 4.14.0 并将 serializeGridData 与 SOAP 请求一起使用。在 IE 11 中,一切都很好,但在 Edge 中,网格没有行,只显示 header。我调试了页面,可以看到 SOAP 请求和响应没有问题。任何人都可以提示我如何找出问题或者解决这个问题的方法。谢谢
您需要解析的XML数据包含命名空间。您使用 "rs\:data"
和 "z\:row"
等转义字符串来解析数据。
xmlReader: {
root: "rs\:data",
row: "z\:row",
repeatitems: false,
id: "[ows_ID]"
}
在您的演示中 https://jsfiddle.net/psturm/rugr8tc0/。这种方式不安全,它取决于您使用的版本 oh jQuery 和您使用的网络浏览器。我建议您使用自己的回调函数,它可以获得所需的 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/
我有一个页面,我在其中使用免费的 jqGrid 4.14.0 并将 serializeGridData 与 SOAP 请求一起使用。在 IE 11 中,一切都很好,但在 Edge 中,网格没有行,只显示 header。我调试了页面,可以看到 SOAP 请求和响应没有问题。任何人都可以提示我如何找出问题或者解决这个问题的方法。谢谢
您需要解析的XML数据包含命名空间。您使用 "rs\:data"
和 "z\:row"
等转义字符串来解析数据。
xmlReader: {
root: "rs\:data",
row: "z\:row",
repeatitems: false,
id: "[ows_ID]"
}
在您的演示中 https://jsfiddle.net/psturm/rugr8tc0/。这种方式不安全,它取决于您使用的版本 oh jQuery 和您使用的网络浏览器。我建议您使用自己的回调函数,它可以获得所需的 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/