loadingRecords conflicts with zeroRecords or emptyTable when dataTable returns empty value

loadingRecords conflicts with zeroRecords or emptyTable when dataTable returns empty value

bcesarsbcesars Posts: 1Questions: 1Answers: 0
edited December 2014 in Free community support

Hi Everyone,

I'm facing an issue when I try to load a web page using dataTable with no records found.
After investigating, I saw two options when I using in language configuration that somehow conflicts each other when posting a message to the user.

I'm using DataTables 1.10.4 version.

When dataTable is loading data from a request Ajax, the message setted in loadingRecords shows to the user and saying "Carregando...".

If there are data available to show in dataTable, this message from loadingRecords disappears and all data are available to the final user.

If there are no data available to show in dataTable, the option zeroRecords should take over and shows to the user the message "Nenhum registro encontrado".
But the problem is the message "Carregando..." still showing and nothing happen. This is awful if the final user expects some data in the page.

Is there a known issue about zeroRecords message not working?
Even if I try to use emptyTable this dataTable won't work.

By the way, after remove loadingRecords option and refresh the browser, the message from zeroRecords works. BUT, if there data to be processed, this message still there and only disappears after loading entire table.

Here following config dataTable:

$(document).ready(function(){
    var Server = window.location.hostname;
    $("#datatable-4").DataTable({
        //processing: true,
        //serverSide: true,
        ajax: {
            url: "http://"+ Server +"/epedidos/Clientes/RequestAllClientes",
            type: 'POST'
        },
        columns: [
            {data: "IdCliente"},
            {data: "Inclusao"},
            {data: "IdERP"},
            {data: "NomeFantasia"},
            {
                data: "CidadeId",
                type: "string"
            },
            {data: "Telefone"}
        
        ],
        language: {
            search:         "Buscar:",
            loadingRecords: "Carregando...",
            processing:     "Processando...",
            zeroRecords:    "Nenhum registro encontrado",
            emptyTable:     "Não há dados disponíveis na tabela",
            lengthMenu:     "Mostrando _MENU_",
            info:           "Mostrando de _START_ a _END_ de _TOTAL_ registros",
            infoEmpty:      "Mostrando de 0 a 0 de 0 registros",
            infoFiltered:   "(Filtrado de _MAX_ registros totais)",
            infoPostFix:    "",
            decimal: ",",
            thousands: ".",
            paginate: {
                first:      "Primeiro",
                previous:   "Anterior",
                next:       "Próximo",
                last:       "Último"
            },
        }
        
    });
    $.fn.dataTable.ext.errMode = 'throw';
});

Could someone help me with this problem?

This discussion has been closed.