0
これは私のdrawCallBack機能である:Datatables:drawCallBackの後にテーブルHTMLを角でコンパイルしたときのページネーションを取得する方法は?
"fnDrawCallback": function(oSettings) {
console.log("dt redrawn");
var selector = $("#example_table");
console.log(selector);
function recompileForAngular() {
angular.element(document).injector().invoke(['$compile', function ($compile) {
// Create a scope.
var $scope = angular.element(document.body).scope();
// Specify what it is we'll be compiling.
var to_compile = $(selector).html();
// Compile the tag, retrieving the compiled output.
var $compiled = $compile(to_compile)($scope);
// Ensure the scope and been signalled to digest our data.
$scope.$digest();
// Replace the compiled output to the page.
$(selector).html($compiled);
}]);
}
function init(recompile) {
recompile();
}
init(recompileForAngular);
},
データテーブルがロードされたときにこれが正常に動作しているが、別のページ(例えば2ページ目)をクリックすると、HTMLが新しいデータで更新取得されていないテーブルから返されましたAJAX呼び出し。
$("#example_table").html();
から古いHTMLをコンパイルしているようです。
レンダリングが完了したときにイベントをキャプチャする方法(新しくレンダリングされたHTMLを再コンパイルできるようにする方法)を教えてください。