change zeroRecords ? message on reload

change zeroRecords ? message on reload

crush123crush123 Posts: 417Questions: 126Answers: 18

i have a datatable using ajax json source, with a filter parameter

by default, on page load, i want the table to be empty, so use an empty string as the parameter

on entering text in a text field and clicking a button, the text field value is passed as a parameter, and the table is reloaded.

$("#confirm").click(function(){
    emailaddress = $('#Email_Address').val();
    table.ajax.url('/ajax/invoices.php?OrderEmail='+emailaddress).load();
}); 

At the moment, i have a message displayed in the table on zeroRecords, so when the page is loaded, the message is displayed.

language: {
        "zeroRecords": "Confirm your email address above to display the ticket orders placed"
    },

How can i change this message on reloading the data, so that if no rows are returned, the user is given a visual clue that there are no rows, - otherwise it looks like nothing has happened

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin
    Answer ✓

    by default, on page load, i want the table to be empty, so use an empty string as the parameter

    Does that work? Does it not just make an ajax request for the host page (which is what I would have thought).

    How can i change this message on reloading the data

    I'm afraid there is no API for that at the moment. All of the language strings can only be set during initialisation. I don't really have a suggested way to do this in DataTables at the moment other than to do it outside of DataTables. Perhaps not showing the table before data is loaded into it for example.

    Allan

  • crush123crush123 Posts: 417Questions: 126Answers: 18

    I'm afraid there is no API for that at the moment. All of the language strings can only be set during initialisation. I don't really have a suggested way to do this in DataTables at the moment other than to do it outside of DataTables.

    No worries, i just added a div to the page and updated its content on button click instead

This discussion has been closed.