jqgrid viewGridRow bug?

时间:2011-02-09 18:00:23

标签: jqgrid

我正在使用tableToGrid功能以及viewGridRow功能。调用viewGridRow方法时,对话框将正确显示。但是当使用寻呼机按钮分页记录时,或者当您关闭对话框并在另一条记录上执行viewGridRow方法时,名称中包含空格(“”)的所有列的值都不会更新。它们保留第一个viewGridRow执行所放置的值。名称没有空格的所有列的值都会按原样更新。

我尝试过recreateForm:true(虽然这是editGridRow方法的属性,而不是viewGridRow方法),但这并没有解决问题。还尝试了其他设置的各种半随机组合。

以下是我的代码。想法?

tableToGrid("#mytable", height:'400',
 ondblClickRow: function(rowid,iRow,iCol,e) {
 jQuery("#mytable").viewGridRow(rowid, {closeOnEscape:true});
 }
});
<table id="mytable">
<thead>
 <tr class="header">
 <th id="CustomerID">CustomerID</th>
 <th id="Account ID">Account ID</th>
 <th id="Customer">Customer</th>
 <th id="System">System</th>
 <th id="Make/Model">Make/Model</th>
 <th id="Modality">Modality</th>
 <th id="Last Login">Last Login</th>
 <th id="Attachments">Attachments</th>
 <th id="Alerts">Alerts</th>
 <th id="Last Log Entry">Last Log Entry</th>
 <th id="Last HE Level">Last HE Level</th>
 <th id="HE Level Threshold">HE Level Threshold</th>
 <th id="DBOD Threshold">DBOD Threshold</th>
 <th id="HE Data Latency">HE Data Latency</th>
 </tr>
 </thead>
 <tbody>
 <tr>
 <td>1</td>
 <td>32222222</td>
 <td>ABC Company</td>
 <td>Smith Warehouse Bay #1</td>
 <td>Make/Model</td>
 <td>MRI</td>
 <td>Dec 20 2010 12:18PM by Frank Smith</td>
 <td>0</td>
 <td>0</td>
 <td></td>
 <td></td>
 <td>60</td>
 <td>0.35</td>
 <td></td>
 </tr>
 …
 </tbody>
</table>

1 个答案:

答案 0 :(得分:0)

您的错误是您明确定义了转换为jqGrid的<th> <table>个元素的ID。如何从tableToGrid函数的源代码中看到(最有趣的是the lines 37-38nameindex列属性将从{{1}获取如果存在,则具有空格的ID由jqGrid支持,因为它们在许多jQuery选择器中不起作用。

请阅读the reference,其中介绍了CSS标识符的限制。你应该遵守这些限制。

因此,我建议您只删除<th>元素中的id属性,或者为ID选择其他没有空格的值。