What triggers the display of language strings?

What triggers the display of language strings?

awarnockawarnock Posts: 11Questions: 2Answers: 0

I'm trying to figure out what causes the various language strings (emptyTable, zeroRecords, loadingRecords and processing) to display while using DataTables to display results from an AJAX call. I don't understand the difference between emptyTable and zeroRecords, nor when the loadingRecords and processing strings display.

My use case is that I make an AJAX call which might return anything from 0 to thousands of records. My expectation is that the processing string would be displayed before the AJAX call completes, then loadingRecords would show until all of the layout is complete, which would either show the rows or show the zeroRecords string. That obviously isn't correct. What I get is zeroRecords showing until the rows display if emptyTable is null, or emptyTable. Neither is correct - the table isn't empty nor are there 0 records. The records just haven't been displayed.

So, my question is, how do I show that the table is loading records after the AJAX call completes, and then show an appropriate message if there were, in fact, no records?

Thanks. Maybe this is simple, but I can't find anything in the docs that tells me what actually triggers the display of each of those state-dependent messages.

This question has accepted answers - jump to:

Answers

  • kthorngrenkthorngren Posts: 20,298Questions: 26Answers: 4,769
    Answer ✓

    Are you using the ajax option or a separate jQuery ajax()?

    What I get is zeroRecords showing until the rows display if emptyTable is null, or emptyTable. Neither is correct - the table isn't empty nor are there 0 records. The records just haven't been displayed.

    Are you saying that the display is showing 0 records but there are records in the table?

    Please post your Datatables config so we can get an idea of what you have.

    Kevin

  • awarnockawarnock Posts: 11Questions: 2Answers: 0

    Thanks for the response. I'm going to have to go digging into my code to find the particular table which was giving me problems. I'll get back to you.

    In the meantime, I'm still trying to find out the conditions which trigger each of those messages to display. That would go a long way to helping be understand what's going on behind the scenes.

  • awarnockawarnock Posts: 11Questions: 2Answers: 0

    Sorry - let me also answer directly. It's not that there are 0 records showing in the display. It's that the zeroRecords message is showing while the table is loading and/or formatting (I can't tell when the loading is complete and the table structure is being built).

  • tangerinetangerine Posts: 3,348Questions: 36Answers: 394
    Answer ✓

    Please post your Datatables config so we can get an idea of what you have.

  • awarnockawarnock Posts: 11Questions: 2Answers: 0

    OK - I will dig up an example. Thanks.

  • awarnockawarnock Posts: 11Questions: 2Answers: 0

    Well, I've got several dozen instances of DataTables across my entire app and, unfortunately, I can't find the one that was giving me problems.They seem to be loading quickly enough now that I can't isolate when the different messages display.

    We should close this question with my profound thanks for your answers above.

This discussion has been closed.