fnVersionCheck determines 1.10.x is valid for version 1.9.x

fnVersionCheck determines 1.10.x is valid for version 1.9.x

bcwilliamsbcwilliams Posts: 3Questions: 2Answers: 0

When testing for version 1.10 i noticed that version 1.9 incorrectly states it passes the version check, here is an overridden code snipped for on that passes 1.9 and 1.10 correctly:

$.fn.dataTable.fnVersionCheck = function (sVersion) {
    var aThis = $.fn.dataTable.ext.sVersion.split('.');
    var aThat = sVersion.split('.');

    var passes = true;

    for (var i = 0, iLen = aThat.length; i < iLen; i++) {
        if (!(parseInt(aThis[i]) >= parseInt(aThat[i]))) {
            passes = false;
            break;
        }
    }

    return passes;
};

I am doing this as an override to the base method, so it will work when checking the old versions as well as the new.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,800Questions: 1Answers: 10,115 Site admin
    Answer ✓

    Doh - that's rubbish isn't it... Thanks for flagging that up. I'll commit and fix and post back here when done.

    Allan

  • allanallan Posts: 61,800Questions: 1Answers: 10,115 Site admin

    Hi,

    Just been looking into this, and I misunderstood slightly last night. You are using v1.9 of DataTables and testing for v1.10 - so this is a bug in v1.9? I've just reproduce that error here: http://live.datatables.net/nozigodo/1/edit .

    Unfortunately 1.9.x is no longer supported and won't see any new releases, but it is very much worth having this bug documented, thanks for opening the discussion and posting the fix!

    Allan

  • bcwilliamsbcwilliams Posts: 3Questions: 2Answers: 0

    I am using both 1.9 and 1.10, slowly converting my app over to use 1.10 and I have some shared code that will need to work with both until I can complete the conversion.

    You wont see this problem again until you go from 2.9 to 2.10.

    If someone else is doing what I am you can just include that snippet anywhere after datatables is loaded; it will work with both 1.9 and 1.10.

This discussion has been closed.