Trouble implementing datatable server side (Php/mysqli)

Trouble implementing datatable server side (Php/mysqli)

guihamelguihamel Posts: 10Questions: 0Answers: 0
edited August 2013 in DataTables 1.9
Hi, in the past, I have used datatables succesfully in a server side situation.

I'm now faced having to use it again in a similar way but with major differences. In the first (and working) iteration, the datatable is showed on the main page (first tab) of the web page.

Now, on my 2nd app, the datatable is on a "secondary" page (the 5th tab) of the web page. If I put the $(document).ready(function() initialization in the main header, it breaks the rest of the site. I was wondering if it was possible to call the initialization in a different method.

As far as the query is concerned, I have validated the JSON output with jsonlint and it is all valid.

Replies

  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    In what way does it break? Please link to a test case: http://datatables.net/forums/discussion/12899/post-test-cases-when-asking-for-help-please-read .

    You can initialise DataTables at any point you want, as long as the table node is in the document.

    Allan
  • guihamelguihamel Posts: 10Questions: 0Answers: 0
    Im working on creating the live exemple using your site but it will be a bit incomplete because its server side processing. Thank you. I'll also provide screenshots.

    In the meantime, can you clarify what you mean by "as long as the table node is in the document" ??
  • guihamelguihamel Posts: 10Questions: 0Answers: 0
    http://imgur.com/a/8AhTO

    Here, I uploaded 3 screenshot
    1- my initialization code (that I added to my pageheader.php file)
    2- the look of the main page after the code has been added (not a page with datatable)
    3- what the page is supposed to look like.

    Also, the actual datatable is located in the tab "Time Entry" and is never loaded properly.

    I have added some javacript alerts to try and diagnose where the problem is happening and found out that an alert just before the initialization code is called, but one right after is never called.

    As far as the node is concerned, it's located on the timeentry.php page. As a last resort, I moved my initialization on that page (timeentry) and it fixed the other pages back to their normal state but has yet to make my datatable work.

    I also have made sure that the json output is valid.
  • guihamelguihamel Posts: 10Questions: 0Answers: 0
    All good, managed to "rubber duck" myself out of it. All is good in datatable land :)
This discussion has been closed.