【问题标题】:jQuery tablesorter: filter and zebra widgets stop working after ajax update IE8 onlyjQuery tablesorter:仅在 ajax 更新 IE8 后过滤器和斑马小部件停止工作
【发布时间】:2013-03-08 16:46:34
【问题描述】:

我正在使用版本动态更新表 jquery-1.7.2.min, TableSorter 2.7.12 分钟, tableSorter 2.4+ 小部件 - 2013 年 2 月 24 日更新。

代码在 IE9 和 Chrome 中运行良好,但在 IE8 中,过滤器和斑马小部件在 ajax 更新后停止工作,排序仍然有效。

<table class="tablesorter">
    <thead>
        <tr>
            <th style="width: 145px;">Orig_Time</th>
            <th style="width: 145px;">Corra_Time</th>
            <th style="width: 120px;">Site</th>
            <th style="width: 120px;">Area</th>
            <th>Reference</th>
        </tr>
    </thead>
    <tbody>
    </tbody>
</table>
$(document).ready(function() {
 $("table").tablesorter({
    sortList: [[0, 1]],
    widthFixed: true,
    theme: 'green',
    widgets: ["filter", "stickyHeaders"],
    widgetOptions: {
        stickyHeaders: "tablesorter-stickyHeader",
        filter_cssFilter: "tablesorter-filter",
        filter_hideFilters: false,
        filter_functions: {
            3: {
                "Midlands+North": function(f) {
                    return f === "Midlands" | f === "North";
                },
                "Scotland+NI": function(f) {
                    return f === "Scotland" | f === "N.Ireland";
                },
                "South+East": function(f) {
                    return f === "South" | f === "East";
                },
                "Wales+West": function(f) {
                    return f === "Wales" | f === "West";
                },
                "Mid+Nor+Sco+NI": function(f) {
                    return f === "Midlands" | f === "North" | f === "Scotland" | f === "N.Ireland";
                },
                "Sou+Eas+Wal+Wes": function(f) {
                    return f === "South" | f === "East" | f === "Wales" | f === "West";
                }
            }
        }
    }
 });
});

function alarms() {
 $("table tbody").load("includes/alarmsResults.php", function() {
    $("table").trigger("update");
 });
}

window.setInterval(alarms, 10000);

alarmsResults.php 只是运行一个 sql 查询并在&lt;tr&gt;&lt;td&gt; 标签中返回结果。

如果数据是静态的,但在更新过滤器和 zebra 停止工作后,IE8 可以很好地与插件配合使用。请问有什么想法吗?

我已尝试使用 tableSorter 2.1 小部件 - 更新于 2012 年 4 月 2 日和旧过滤器,它可以工作,但它没有自定义过滤器选项。

干杯。

【问题讨论】:

  • 您能否尝试在更新后添加.trigger('refreshWidgets'),看看是否能解决您的问题(ref)。
  • 嗨...更新后我已经尝试过刷新,但仍然没有乐趣。
  • 能否请您设置一个演示。
  • 试图在这里设置一个示例link 但 IE8 甚至不会加载该站点。
  • 在您的 ajax mottie.github.com/tablesorter/docs/example-ajax.html 示例中,您是否可以添加斑马或过滤器小部件进行测试。我知道 IE8 很痛苦。

标签: javascript jquery html tablesorter


【解决方案1】:

我找到了问题,我!我在最后一个&lt;/tr&gt; &lt;small&gt;$time&lt;/small&gt; 之后添加了sql 查询在返回的数据中运行的时间。 IE8 不喜欢它,因为它包含在没有&lt;tr&gt;&lt;td&gt; 标签的 tbody 中,IE9 和 chrome 只是忽略了它。

【讨论】:

    猜你喜欢
    • 2012-09-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-18
    • 2012-12-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多