【datatable】正在加载中的信息提示

datatable插件

DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, based upon the foundations of progressive enhancement, and will add advanced interaction controls to any HTML table.

datatable官方网站

使用中加上正在加载的提示

var createProcessing = function(){
    var processingMessage = "";
    processingMessage += '<div id="dataTables_processing" class="dataTables_processing" style="display: none;">' + '正在加载中...' + '</div>'
    $("table.table").before(processingMessage);
}

var initDatatable = function(options) {

    options = $.extend(true, {
        // Or you can use remote translation file
        "processing": true,
        "ajax" : {
            beforeSend : function(){
                $("#dataTables_processing").show();
            },
            complete : function(){
                $("#dataTables_processing").hide();
            } 
        },
...

在ajax中加上beforesend 和 comeplete 然后加载前显示和隐藏加上的正在加载的div块,注意此块的id 样式都已经是插件写好的

参考方案

posted @ 2015-06-22 16:24  jeremylee  阅读(2800)  评论(0)    收藏  举报