当使用 jQueryUI 可排序删除一行时,1 个额外的表格单元格(但仅限 Chrome)

发布于 2024-12-12 04:34:34 字数 1903 浏览 0 评论 0原文

我有一个使用 jQuery、jQuery UI 和 Backbone.js 的应用程序。最近出现了一个错误,当表中的一行被删除时(jQUery Sortable),不同的行有时会在一行上移动,就好像有一个额外的单元格一样,但经过检查后并没有。我刚刚指出,这只发生在 Chrome、Chromium 和 ChromeFrame 中。

这是问题区域的屏幕截图: http://img208.imageshack.us/img208/ 6870/screenshotkz.png

这是 Chrome 检查界面中 HTML 的屏幕截图:http://img16.imageshack.us/img16/6985/screenshot1wdo.png 我还复制了下面的 HTML:

<tr id="17052151" class="wo">
<td>17052151</td>
<td>XXXXXXXXXXX</td>
<td>XXXXXXXXXXXXX</td>
<td>Parts Here</td>
<td>RR</td>
<td>10/28/11</td>
<td>10/28/11</td>
<td>10</td>
<td><input type="text" class="woComment" value=""></td>
<td class="removeWO">X</td>
</tr>
<tr id="10097756" class="wo">
<td>10097756</td>
<td>XXXXXXXXXXXX</td>
<td>XXXXX</td>
<td>Parts Here</td>
<td>NIS</td>
<td>10/04/11</td>
<td>10/28/11</td>
<td>10</td>
<td><input type="text" class="woComment" value=""></td>
<td class="removeWO">X</td>
</tr>
<tr id="10095965" class="wo">
<td>10095965</td>
<td>XXXXXXXX</td>
<td>XXXXXXXXXXXXXXXX</td>
<td>Parts Here</td>
<td>NIS</td>
<td>09/16/11</td>
<td>10/10/11</td>
<td></td>
<td><input type="text" class="woComment" value=""></td>
<td class="removeWO">X</td>
</tr>

由于在 Firefox 或 IE8 中不会出现此问题,我认为这可能是 Chrome 的错误,但我想看看是否有其他人以前遇到过此问题。

编辑 我发现为出现问题的视图元素调用 .render() 函数可以修复此问题。

I have an application that uses jQuery, jQuery UI, and Backbone.js. A bug has recently developed where a row in the table when it is dropped (jQUery Sortable) a different row will sometimes shift over a row as if there was an extra cell, but upon inspection there is not. I have just noted that this only happens in Chrome, Chromium, and ChromeFrame.

Here is a screenshot of the problem area: http://img208.imageshack.us/img208/6870/screenshotkz.png

Here is a screenshot of the HTML in Chrome's inspection interface: http://img16.imageshack.us/img16/6985/screenshot1wdo.png
I have also copied the HTML below:

<tr id="17052151" class="wo">
<td>17052151</td>
<td>XXXXXXXXXXX</td>
<td>XXXXXXXXXXXXX</td>
<td>Parts Here</td>
<td>RR</td>
<td>10/28/11</td>
<td>10/28/11</td>
<td>10</td>
<td><input type="text" class="woComment" value=""></td>
<td class="removeWO">X</td>
</tr>
<tr id="10097756" class="wo">
<td>10097756</td>
<td>XXXXXXXXXXXX</td>
<td>XXXXX</td>
<td>Parts Here</td>
<td>NIS</td>
<td>10/04/11</td>
<td>10/28/11</td>
<td>10</td>
<td><input type="text" class="woComment" value=""></td>
<td class="removeWO">X</td>
</tr>
<tr id="10095965" class="wo">
<td>10095965</td>
<td>XXXXXXXX</td>
<td>XXXXXXXXXXXXXXXX</td>
<td>Parts Here</td>
<td>NIS</td>
<td>09/16/11</td>
<td>10/10/11</td>
<td></td>
<td><input type="text" class="woComment" value=""></td>
<td class="removeWO">X</td>
</tr>

Since this problem does not occur in Firefox or IE8 I am thinking it might be a Chrome bug, but I wanted to see if anyone else had experienced this issue before.

EDIT
I have found that calling the .render() function for my view element that the issue occurs in fixes this issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清音悠歌 2024-12-19 04:34:34

也许我完全没有理解你的观点,但你能否澄清一下:你确实希望整行都可以排序,这意味着第 1 行、第 2 行和第 3 行可以通过拖动互换?

如果是这种情况,您实际上应该使 tbody 成为可排序的,而不是 tr;将可排序应用于 tr 是导致这里出现奇怪行为的原因,因为 jqueryui 试图使 tr 的内容可排序,这非常糟糕。要对行进行排序,请使 tbody 可排序,以便它尝试对表行进行排序。

http://jsfiddle.net/cZ4n4/10/

Maybe I am totally missing your point, but could you clarify: You do want the whole row to be sortable, meaning row 1, row 2 and row 3 are interchangeable by dragging?

If that was the case, you would actually make the tbody a sortable, not the tr; applying the sortable to the tr is what causes weird behaviour here, as jqueryui tries to make the contents of the tr sortable, which goes awefully bad. To sort the rows, make the tbody a sortable, so it tries sorting the table rows.

http://jsfiddle.net/cZ4n4/10/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文