jquery tablesorter 禁用提交功能
我有一个表,正在使用 tablesorter (http://tablesorter.com) 进行排序。 该表中有一个带有提交按钮的列。 每个表行都有一个提交按钮。 在排序之前,按钮运行良好并提交由 PHP 脚本处理的 POST 请求。
之后使用tablesorter对表格进行排序,按钮接缝将被停用。 它们的行为就像 JavaScript 返回 false 一样。 这意味着不会发生页面刷新。
有人可以帮助我吗,a 排序后仍然可以提交吗?
非常感谢,马克斯
I've got a table which Im sorting with tablesorter (http://tablesorter.com). Within that table there is a column with submit buttons. Each table row has got a submit button. Before sorting, the buttons work great and submit a POST request which is processed by a PHP script.
AFTER sorting the table with tablesorter the buttons seam to be deactivated. They behave as if a JavaScript returns false. That means, that no page refresh happens.
Can someone help me, that a can still submit after sorting?
Thanks a lot, Max
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
向我们展示代码(在这里或通过诸如pastebin.com之类的网站)以获得真正的答案。 除此之外,我最好的猜测是,对表格进行排序是将按钮移到使它们运行的“表单”标签之外。 不管我的猜测是否完全错误,我要做的第一件事就是在表格排序后使用 FireBug 检查元素,看看哪里出了问题。
Show us the code (here or via something like pastebin.com) for the real answer. Barring that, my best guess is that sorting the table is moving the buttons outside of the "form" tags that make them operate. Whether my guess is totally wrong or not, the first thing I would do is use FireBug to examine the elements after the table is sorted and see what's wrong.
我的猜测是 tablesorter 插件正在从 DOM 中添加/删除元素。 发生这种情况时,事件处理程序将被删除。 您可能想尝试使用
live
方法添加事件处理程序。 即使元素被删除/添加,这也应该允许应用它们(假设它们是点击处理程序)。My guess would be that the tablesorter plugin is adding/removing elements from the DOM. When this happens the event handlers are being removed. You might want to try adding the event handlers with the
live
method. This should allow them to be applied (assuming they are click handlers) even when the elements are removed/added.每行表单必须位于
tr
内部,而不是外部,这样当您使用 tablesort 对表进行排序时,表单不会被删除。Form must be inside
tr
, not outside for each line, then the form is not removed when you sort the table with tablesort.