Can't make a given example to work [solved]

Can't make a given example to work [solved]

jpmurrayjpmurray Posts: 6Questions: 0Answers: 0
edited June 2011 in General
I'm trying to generate the tables as per this example: http://www.datatables.net/release-datatables/examples/data_sources/server_side.html

Problem is... Nothing works ! The table seems not to generate itself, and I'm having no (visible?) error, so I can't really find what the problem is. I though it might be a json problem, but taking the server side code given in the example and trying to load it directly throws me a bunch of error (it seems to wait for some GET variables that datatables() sends?)

So well... I guess my first question would be: how could I debug this example, if I don't see any error, except the table not being generated?

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    > how could I debug this example

    Use Firebug and compare the XHR in my working demo to the one in your setup.

    Allan
  • jpmurrayjpmurray Posts: 6Questions: 0Answers: 0
    edited June 2011
    I feel sorry for myself. I've got too used to Chrome that I forget that Firebug exists :)

    It would seem that I'm not even going to the XHR request at all!

    k is undefined
    http://idefix/generateurs/zOutils/plugins/jquery-datatables/jquery.dataTables.min.js
    Line 151
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    "Inspector" in Chrome is every bit as good as Firebug is in Firefox (its what I use, it's just easy to say "Firebug" :-) ). I'd suggest running the non-min version of DataTables as the minified one is a nightmare to debug.

    Allan
  • jpmurrayjpmurray Posts: 6Questions: 0Answers: 0
    Well, you just made me realize that Inspector do get XHR requests. Oh well. It's been too long, too much to learn back! :)

    Ok, I've unminifed the code, and... There is the error !

    __
    oColumn is undefined
    http://idefix/generateurs/zOutils/plugins/jquery-datatables/jquery.dataTables.min.js
    Line 7247
    __

    I was thinking it might be cominf from the PHP at the end of it all, but it still doesn't try and load any XHR request from it, so I'm really clueless! (And truth be told, it's the first time I can't make datatables to work! Otherwise (when it's built manually) it's just working out of the box, like magic!)
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Interesting one - that line not working suggests that no columns have been found. Do you have columns and a THEAD / TBODY?

    Allan
  • jpmurrayjpmurray Posts: 6Questions: 0Answers: 0
    You know what?

    It was exactly what was missing. But weirdly, not because I haven't tried. Yesterday, I had my table, all set, and datatable.js was sending me a javascript alert about it not being able to populate the table, or something like that.

    I just wrote back the table as it should and... It's working!

    I'm puzzeled, but well.. THANKS !! Now that this is resolved, your work on datatables will avoid me many headaches!
  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    I am a bit too - as DataTables should insert a THEAD / TBODY if needed - although I'm not sure about no columns (since you can't add them dynamically and there is no point in having a table with no columns :-). However, as long as it is working... :-)

    Allan
  • jpmurrayjpmurray Posts: 6Questions: 0Answers: 0
    Indeed! :) Now, time to dive in fnRowCallback to customize the stuff!

    Thanks again!
  • jpmurrayjpmurray Posts: 6Questions: 0Answers: 0
    FYI, I just found out why it was throwing me an error message. I feel dumb not to have though about that before !

    I'm curently using a basic template for a webapp, and... It had a custom function to generate basic tables via a class selector called "datatable". And guess what class I gave to my own tables generated?

    That's right.

    Now, I'm out hiding in shame! :P
This discussion has been closed.