【发布时间】:2012-09-05 02:37:39
【问题描述】:
我有一个带有 html 表格的页面,该表格使用表格排序器并在加载时进行排序。我希望我的 dom 解析器脚本仅在排序后才从该表中获取行。现在它正在跳过排序并抓取之前的行。
【问题讨论】:
标签: php jquery dom html-parsing tablesorter
我有一个带有 html 表格的页面,该表格使用表格排序器并在加载时进行排序。我希望我的 dom 解析器脚本仅在排序后才从该表中获取行。现在它正在跳过排序并抓取之前的行。
【问题讨论】:
标签: php jquery dom html-parsing tablesorter
使用 sortEnd 事件
$(document).ready(function() {
// call the tablesorter plugin, the magic happens in the markup
$("table").tablesorter();
//assign the sortStart event
$("table").bind("sortStart",function() {
// Do stuff when the sorting begin
}).bind("sortEnd",function() {
// To stuff when the sorting ends
});
});
【讨论】:
如果您在 Javascript 中使用 DOM Parser,请尝试将 defer="defer" 属性添加到 Javascript 的标记中。
如果您在 PHP 中使用该函数,则可以尝试根据需要多次调用函数sleep()。
【讨论】:
你也可以尝试在完成排序事件上做某种数据属性标志,在php开始解析之前,检查它是否真的可以通过检查这个标志来完成,如果不能,然后再等待稍后再试.
【讨论】: