Datatables and JQuery 1.5

Datatables and JQuery 1.5

bryceray1121bryceray1121 Posts: 65Questions: 0Answers: 0
edited February 2011 in General
If this is already posted, I didn't see it. But, is the current version of Datatables compatible with the newly released JQuery version 1.5?

Replies

  • GregPGregP Posts: 500Questions: 10Answers: 0
    Anybody is only using a subset of DataTables' complete feature list, but I can tell you that I'm using jQuery 1.5 and DataTables with no issues to report so far.
  • jQuery_userjQuery_user Posts: 27Questions: 0Answers: 0
    No problems here too!

    BTW, can anybody tell what are the highlights/changes in 1.5?
  • GregPGregP Posts: 500Questions: 10Answers: 0
    http://blog.jquery.com/2011/01/31/jquery-15-released/

    Improved Ajax, faster lateral DOM traversal are the big ones to me. The sub() function could prove useful, too; I just don't know how yet. ;-)
  • allanallan Posts: 63,400Questions: 1Answers: 10,452 Site admin
    I've just run the DataTables unit tests with jQuery 1.5 and it passes no problem at all. Interestingly it is slightly slower than 1.4.x so there might be something which can be tuned a bit more, or possibly just jQuery has a bit more overhead (there are a lot of tests :-) ). Either way, jQuery 1.5 works perfectly well with DataTables 1.7.5 and probably most other versions, so happy to call DataTables supported for that.

    @jQuery_user - there is a description of the new features available on the jQuery blog from John Resig: http://blog.jquery.com/

    Regards,
    Allan
  • MikeSMikeS Posts: 113Questions: 1Answers: 0
    Allan,

    I just did a quick test with datatables 1.7.5 and jQuery 1.5 using the datatable samples that come with the zip package. I've only done this test for the "Ajax source" sample under the "Data sources" title in the Index page and I'm finding that this example fails to show the data.

    I'd simply renamed the existing jquery.js file found in the media\js folder to jquery_old.js and put the jquery.1.7.5.js in its place (named jquery.js) and then tried to run that example. It does not load the data from examples_support\json_source.txt into the datatable and says, "No data available in table".

    Can you please confirm that this is not something stupid that I'm doing to cause this trouble?

    Thanks.
  • allanallan Posts: 63,400Questions: 1Answers: 10,452 Site admin
    Sounds odd - I'm not seeing that problem with jQuery 1.5. Any chance you can put your example online so I can see it happen? It sounds like what you have done is quite reasonable.

    Allan
  • GregPGregP Posts: 500Questions: 10Answers: 0
    I wonder if the browser is failing out on its caching mechanism somehow? What if you name the 1.5 version something unique, and then in your page also call it by its unique name rather than the original jquery.js?
  • MikeSMikeS Posts: 113Questions: 1Answers: 0
    edited February 2011
    Allan,

    I'm afraid don't have any means of placing my example online. As I've mentioned before, it is the same examples from your package except for the fact that I've changed the jQuery.js to be jQuery version 1.5. If I use jQuery version 1.4 everything works fine! Please see my reply to GregP below.

    GregP,

    I did as you suggested. I named the jQuery.js to jQuery.1.5.js and changed the code in the ajax.html to be:

    [code]

    [/code]

    and it still does not work for me. Notice in this screen capture how the "Processing" indicator is still hanging around, http://tinypic.com/r/30vyyrp/7

    UPDATE: Chrome shows the "Processing" indicator while IE8 does not. Neither shows the data from the json file.
  • allanallan Posts: 63,400Questions: 1Answers: 10,452 Site admin
    If you look in Firebug or Inspector, do you see the XHR going out and data coming back?

    Allan
  • MikeSMikeS Posts: 113Questions: 1Answers: 0
    edited February 2011
    Allan,

    I'm a real noob at this stuff so please bear with me while I try to decipher what you are asking. I opened the "ajax.html" file in chrome and had the "Developer Tools" window open too. I selected the "XHR" option in the Resources. As you can see from the following screen captures, there does not appear to be any information displayed.

    http://i52.tinypic.com/2i23hx.jpg
    http://i55.tinypic.com/vhdnqh.jpg

    Please let me know if there is something obvious that I've missed when trying to get you the information that you need. I did this testing with the following version of jQuery:

    [code]

    [/code]

    If I substitute
    [code]

    [/code]

    all is well, so it is obviously something in the jquery version 1.5 that is causing me grief.

    I've tried the full version (i.e., non-minified) of jQuery 1.5 to see if that makes a difference but it too fails to render any data.
  • GregPGregP Posts: 500Questions: 10Answers: 0
    Hi Mike,

    You're in the right general area of Chrome to capture some other relevant information. Instead of the Resources->XHR section, try the Console section. If it's indeed jQuery 1.5 or DataTables, it's likely a JavaScript error halting the script before the data is even properly requested. The Console should report back JavaScript errors.

    Greg
  • allanallan Posts: 63,400Questions: 1Answers: 10,452 Site admin
    Can you post your DataTables initialisation as well was having a look at what Greg suggests please?

    Thanks,
    Allan
  • MikeSMikeS Posts: 113Questions: 1Answers: 0
    I changed my datatables initialization to use aaData instead of json and all is working now with jQuery 1.5.

    Thanks for all the previous assistance with this matter.

    Mike
  • nicochapnicochap Posts: 2Questions: 0Answers: 0
    Hi Allan,

    Are you sure JQuery 1.5 works fine with DataTable 1.7.5?
    i encounter the same problem as describe here:
    http://datatables.net/forums/comments.php?DiscussionID=4133&page=1

    Regards,

    Nicolas
  • allanallan Posts: 63,400Questions: 1Answers: 10,452 Site admin
    It certainly works in my testing setup. Looking through some recent posts on the jQuery forum, it suggests that the validation plugin is not compatible with jQuery 1.5. If used it with make the Ajax call a jsonp call, which results in an invalid label error.

    Allan
  • theyouyoutheyouyou Posts: 12Questions: 0Answers: 0
    I had the same problem !
    Here's the jquery 1.5 compatibility fix for the bassistance validation plugin :
    https://github.com/bigfix/jquery-validation/commit/9aa53f9241224ba349f9fe1b2c801be0f431b63b#L0L1089

    Now it works fine!
  • MikeSMikeS Posts: 113Questions: 1Answers: 0
    edited February 2011
    In an attempt to see what is going on with datatable's JSON datasource and Jquery 1.5 I thought I'd do some snooping around. If I go to the online sample for JSON datasource at http://www.datatables.net/examples/data_sources/ajax.html the datatable renders fine. However, when I looked at the source for that page it references the jQuery script as:

    [code]

    [/code]

    That's fine, until I looked at the jquery.js source and it is version 1.4.4. Unless I'm clueless (and that is a possibility) we're not really using jQuery version 1.5.

    Alan, would it be possible for you to change that to version 1.5 for me to test?
  • GregPGregP Posts: 500Questions: 10Answers: 0
    edited February 2011
    All you have to do is put v1.5 into that directory. If you don't want to update the script tag itself, just rename the files. jquery.js becomes "old_jquery.js" (or whatever) and the 1.5 version gets renamed to "jquery.js".

    I think it's safe to say that the production version of DataTables is still shipping with 1.4.4, but those of us who have switched to 1.5 have either changed the path in the script tag, or have dropped the new jQuery in place with the same filename.
  • MikeSMikeS Posts: 113Questions: 1Answers: 0
    GregP,

    Unless I'm misunderstanding you, are you saying that I can change the jQuery.js on the *live URL* that I'd mentioned (http://www.datatables.net/examples/data_sources/ajax.html )? I didn't think so. That's why I'm asking Alan to change it so I can be sure that I'm not screwing up somewhere in my own work. All I'm asking is for an online live demo that proves that datatables's JSON datasource is compatible with jQuery v 1.5. We know it works with jQuery 1.4.4.

    I've already switched out the jQuery 1.4.4 to use 1.5 on my local testing computer and reported that it does NOT work for me. Take a look up a few posts to see.
  • GregPGregP Posts: 500Questions: 10Answers: 0
    Sorry, I'm the one that misunderstood. I thought you had deployed the demos to your web server. When you said "we're not really using 1.5" I thought you meant people who had deployed it. Reason being: you would be correct-- the default download probably still uses 1.4.4

    I don't know that updating the live demos to 1.5 will help, though. People are using 1.5, including myself, with no issues. That doesn't mean there AREN'T issues (I doubt you're imagining things), but updating the online demos to use 1.5 won't necessarily give you any satisfaction.
  • MikeSMikeS Posts: 113Questions: 1Answers: 0
    No worries.

    As for updating the online demos to use jQuery v1.5, at least it would determine that my issues are a result of my own ignorance. That, to me, will give me satisfaction :)

    Besides, if datatables is truly compatible with jQuery v1.5 (and I have no reason to doubt Alan's claim) what harm would there be in updating the online demos to use it? This way, everyone is on the bleeding edge :)
  • GregPGregP Posts: 500Questions: 10Answers: 0
    Agreed! Especially since 1.5 is considered production release.
  • allanallan Posts: 63,400Questions: 1Answers: 10,452 Site admin
    Hi guys,

    What I plan to do is include jQuery 1.5 in the next release of DataTables - which will be 1.7.6 (hopefully not too far away!). I'd rather not just randomly change the underlying libraries of any released software (be it DataTables or anything else) as that way lies dependency madness :-). However, it should work without any problems - if there is anything 'funny' it would be good to get to the bottom of it.

    @MikeS - if you could give us a link to your page we can take a look and see what might be happening.

    Allan
This discussion has been closed.