具有子网格和本地数据的 JqGrid 在 IE9 中不起作用 - 抛出 - "SCRIPT600: Invalid target element for this operation"



我是JQGRID的新手,使用的是版本4.7.1。

我正在尝试用SUBGRID创建JQGRID。该代码在Google chrome中按预期工作,但我在IE9中收到了下面提到的错误。

SCRIPT600: Invalid target element for this operation. 
jquery.jqGrid.src.js, line 1639 character 6

如何解决错误并使其在IE9中工作。请做必要的事。提前谢谢。

<html>
<head>
<title>My First Grid</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/jquery-    ui.css" />
<link rel="stylesheet" type="text/css" media="screen" href="css/ui.jqgrid.css" />


<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="js/jquery-ui.js" type="text/javascript"></script>
<script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="js/jquery.jqGrid.src.js" type="text/javascript"></script> 


<style>
.ui-jqgrid tr.ui-row-ltr td 
{ 
border-right-color: transparent;
height:auto;
overflow:hidden;    
padding-top:6px;
padding-bottom:6px;
position:relative;
vertical-align:text-top;
white-space:normal !important; 
}
th.ui-th-column { border-right-color: transparent !important }
.ui-jqgrid .ui-jqgrid-btable
{
table-layout:auto;
}
.top-buffer { margin-top:20px; }
.cursorPointer:hover{
cursor:pointer
}

.ui-jqgrid .ui-jqgrid-htable th div {
height:auto;
overflow:hidden;    
padding-top:6px;
padding-bottom:6px;
position:relative;
vertical-align:text-top;
white-space:normal !important;
}

</style>
</head>
<body>
<div >
<table id="grid"></table>
</div>

</body>

<script type="text/javascript">
var mydata = [
{id: "1", label:"No 1", number:"02200220", status:"OPEN", level:"0", parent:  "", isLeaf: false, expanded:false, loaded:true},
{id: "2", label:"No 2", number:"77733337", status:"ENTERED", level:"0", parent: "", isLeaf: false, expanded:false, loaded:true},
{id: "6", label:"No 2a", number:"12345123", status:"WIRED", level:"1", parent: "2", isLeaf: false, expanded:false, loaded:true},
{id: "7", label:"No 2a1", number:"1111111111", status:"WIRED", level:"2", parent: "6", isLeaf: true, expanded:false, loaded:true},
{id: "3", label:"No 3", number:"02200111", status:"OPEN", level:"0", parent: "", isLeaf: false},
{id: "4", label:"No 3a", number:"02200221", status:"OPEN", level:"1", parent: "3", isLeaf: true, expanded:false, loaded:true},
{id: "5", label:"No 3b", number:"02242320", status:"CLOSED", level:"1",   parent: "3", isLeaf: true, expanded:false, loaded:true}
];
var grid = $("#grid");

grid.jqGrid({
// data: mydata, // doesn't work
datatype: "local",
colNames: ['Id', 'Label', 'Number', 'Status'],
colModel: [
{ name:'id',index:'id', width:60, sortable:false},
{ name: 'label', index: 'label', width: 180, sortable:false},
{ name: 'number', index: 'number', width: 120, formatter: function    (cellValue, option, rowObject) 
{
        return "<span><img src='images/play.png'></img></span><span style='padding-left:10px'><img src='images/Download-icon.png'><span>";
    } },
{ name: 'status', index: 'status', width: 120, sortable:false } ],
hidegrid: false,
gridview: true,
sortname: 'id',    
loadonce: true,
treedatatype: 'local',
ExpandColumn: 'label',
height: 'auto',
pager : "#gridPager",
caption: "Prouct Page Table"
});

// we have to use addJSONData to load the data
grid[0].addJSONData({
total: 1,
page: 1,
records: mydata.length,
rows: mydata
});

</script>

</html>

TreeGrid不适用于datatype: "local",但可以使用datatype: "jsonstring"。人们只需要使用datastr: mydata而不是data: mydata。对于顶级图标,您应该额外使用parent: "null"而不是parent: ""。它还允许进行本地排序。请参阅相应代码示例的答案。

问题"jquery.jqGrid.src.js,第1639行"的原因可能是firstElementChild的使用错误。有关详细信息,请参阅答案。修复后,您可以从这里下载jqGrid 4.7.0的jquery.jqGrid.src代码。或者,您可以从我的jqGrid分支下载新的免费jqGrid测试版。

相关内容

  • 没有找到相关文章

最新更新