deferLoading is not considering with fixed columns

deferLoading is not considering with fixed columns

SureshvSureshv Posts: 7Questions: 1Answers: 0
edited June 2016 in Free community support

We've issue with deferLoading along with fixed columns. Here is our use case.

We build dynamic table by retrieving column definitions (meta data) and rows from server (first time, later it only retreives table rows) and create datatable. Later we only retrieve rows from server (server side pagination, sorting, etc..)
All these works pefectly, but if we use fixedColumns, datatable firing ajax request and it is not considering deferLoading setting. Is there anyway we can avoid firing ajax request with fixed columns.

Here is the sample code :

var columns = [];

this.transform = function(data) {
 ...
 return result;
}
 
this.handleSuccess = function(data) {
    var self = this;
    var result = this.transform(data);
    this.grid = $("#mytable").dataTable({
        "autoWidth" : false,
        "lengthChange" : false,
        "paging" : true,
        "pageLength" : 100,
        "pagingType" : "full_numbers",
        "scrollX" : true,
        "scrollY" : 400px,
        "searching" : false,
        "columns" : self.columns,
        "data" : result.rows,
        "dom" : "<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row my-grid-pagination'<'col-sm-2'i><'col-sm-2'><'col-sm-6'p><'col-sm-2'<'#myTableToolbar'>>>",
        "fixedColumns" : true,
        "deferLoading" : result.recordsTotal,
        "serverSide" : true,
        "ajax" : {
            "url" : "mydata.json",
            "type" : "POST",
            "data" : function(d) {
                
            },
            "dataSrc" : function(data) {
                // transform the response data
                result = self.transform(data); // local function to transorm data
                ....
                return result.rows;
            },
            "error" : function(jqXHR, textStatus, errorThrown) {
                console.debug('ajax textStatus : %s, ajax error : ', textStatus, errorThrown);
            }
        },
        "createdRow" : function(row, data, dataIndex) {
          ...
        },
        "footerCallback" : function(row, data, start, end, display) {
          ...
        },
        "initComplete" : function(settings, json) {
            console.debug('initComplete - DataTables has finished its initialisation.');
        },
        "drawCallback" : function(settings, json) {
           ...
        },
        "processing" : true,
        "language" : {
            "info" : "Showing page _PAGE_ of _PAGES_",
            "infoEmpty" : "No records available",
            "processing" : "<i class='fa fa-refresh'></i> Loading..."
        }
    });

}

Please advice on this issue.

Thanks,
Suresh

Replies

  • Tom (DataTables)Tom (DataTables) Posts: 139Questions: 0Answers: 26

    At the moment fixedColumns draws the table after it's own initialisation, the result is effectively that the table draws twice during startup. The first one is the deferred loading draw and second is the fixedColumns initialization.

    This is an issue and we hope to address it in the future, but at the moment there is no workaround.

    Thanks

    Tom

This discussion has been closed.