DataTable - Ajax Objects

DataTable - Ajax Objects

claudneysessaclaudneysessa Posts: 6Questions: 1Answers: 0

Hello, I followed all the steps of the example and I can not make DataTable work with Ajax Objects follow files to identify the problem ... Please help me!

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    Hi @claudneysessa ,

    Yep, that all looks the same as this example here... This here is also a live running example.

    You haven't said what's wrong, so it's hard to make suggestions on how to fix it. Maybe you could clone that test case to demonstrate your problem?

    Cheers,

    Colin

  • claudneysessaclaudneysessa Posts: 6Questions: 1Answers: 0

    I have done exactly as in the example, the table gets the formatting plus the DataSet does not display the records of the file with the Objects .... So I sent the two files I would give to see it not populating the records ...

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736

    Here is your code:

                $('#example').DataTable( {
                    "ajax": "objects.txt",
                    "columns": [
                        { "data": "name" },
                        { "data": "position" },
                        { "data": "office" },
                        { "data": "extn" },
                        { "data": "start_date" },
                        { "data": "salary" }
                    ]
                } );
    

    Sounds like you have objects.txt as a local file. I don't think tis will work as ajax sends an HTTP request to a server for the data. Can you place the file on a web server and update the ajax URL to point to the file on the server?

    Kevin

  • claudneysessaclaudneysessa Posts: 6Questions: 1Answers: 0
    edited September 2018

    exactly this, thank you very much worked very well and you are very obliging and considerate thank you from the bottom of the heart even!

  • claudneysessaclaudneysessa Posts: 6Questions: 1Answers: 0

    is there any file size limitation? I have had good results up to 1mb plus it returns a "DataTables warning: table id = tab1 - Invalid JSON response." For more information about this error, please see http://datatables.net/tn/1 "

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    is there any file size limitation?

    Not in DataTables itself. It is possible your http server might be limiting the reply size, although that would be unusual.

    If you are getting a JSON error message have a look at the tech note it links to for details on how to resolve the issue.

    Allan

This discussion has been closed.