数据表 fnReloadAjax 成功

datatable fnReloadAjax success

我需要使用图标,但当我重新加载数据表时它们消失了。

当我声明数据表时我使用 fnInitComplete

"fnInitComplete": function(oSettings, json) {
    $(".readable_row").button({icons:{secondary:"ui-icon-folder-open"}});
    $(".editable_row").button({icons:{secondary:"ui-icon-wrench"}});
}

有没有办法将 fnInitComplete 与 fnReloadAjax 一起使用?或者等待 fnReloadAjax 成功检索数据并重新加载数据表?

使用附加到绘图事件的处理程序,我能够重新附加图标。我什至不必使用 fnInitComplete.

使用.on()

$("#example").on("draw", function() {
    $(".readable_row").button({icons:{secondary:"ui-icon-folder-open"}});
    $(".editable_row").button({icons:{secondary:"ui-icon-wrench"}});
});

我不得不使用 .delegate() 因为我有一个旧版本的 jQuery :

$("body").delegate("#example", "draw", function() {
    $(".readable_row").button({icons:{secondary:"ui-icon-folder-open"}});
    $(".editable_row").button({icons:{secondary:"ui-icon-wrench"}});
});