简体   繁体   中英

datatable fnReloadAjax success

I need to use icons but they disappear when I reload the datatable.

When I declare the datatable I use fnInitComplete

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

Is there a way to use fnInitComplete with fnReloadAjax? Or maybe a to wait for fnReloadAjax to succeed in retrieving data and reloading the datatable?

Using a handler attached to the draw event I was able to re-attach the icons. I didn't even have to use fnInitComplete .

Using .on() :

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

I had to use .delegate() since I had an older version of jQuery :

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM