Vishal Patel
Vishal Patel

Reputation: 7

DataTable shows 1 insted of empty record message

This is my code for the date table

var table = $('.MyNumbersTable').DataTable({
        "lengthMenu": [
            [10, 25, 50, 100, -1],
            [10, 25, 50, 100, "All"]
        ],
        "aaSorting": [],
        "language": {
            "zeroRecords": "You don't have any numbers."
        }
});

The issue is when there are records in my numbers table it displays records, It is fine. But when if there is no record in table it show '1' as record instead of display message.

enter image description here

Upvotes: 0

Views: 818

Answers (1)

DreamTeK
DreamTeK

Reputation: 34267

Please see notes regarding language.zeroRecords: https://datatables.net/reference/option/language.zeroRecords

Note that language.emptyTable is shown when there is simply no information in the table at all (regardless of filtering), while this parameter is used for when the table is empty due to filtering.

It seems you may wish to use language.emptyTable : https://datatables.net/reference/option/language.emptyTable

Upvotes: 1

Related Questions