autoComplete.js compatibility?

autoComplete.js compatibility?

epep Posts: 24Questions: 6Answers: 0

Hello,

when using autoComplete to Edit an entry of my database with DataTables I receive the javascript error message

Uncaught TypeError: this.source is not a function

with several references to jquery ui. Alas, when I enter a new entry to my database all works surprisingly well. I suspect that the version of autoComplete isn't compatible with the javascript libraries I use. I use one of the last DataTables bundles including

DataTables 1.10.16
jQuery 3.2.1
jquery ui 1.12.1 custom

Could you please tell me which version of autoComplete.js fits best to this configuration?

Thanks,
Eberhard

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,336Questions: 26Answers: 4,951

    Here is a recent discussion about autoComplete.js:
    https://datatables.net/forums/discussion/comment/124209/#Comment_124209

    Seems like that error is an autoComplete.js error not Datatables. A google search yields this as one of many results:
    https://stackoverflow.com/questions/14598743/this-source-is-not-a-function-error-while-implementing-autocomplete

    But without seeing an example of the issue its hard to debug the issue. Can you provide a link to your page or a test case?

    Kevin

  • epep Posts: 24Questions: 6Answers: 0

    I just sent a personal message to you.

    Eberhard

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you send it to me as well please? Kevin doesn't work for DataTables - he's just an exceptionally kind hearted sole who is helping out and I don't want to take (too much ;)) advantage of him :).

    If you could show your AutoComplete initialisation here as well that would be useful. It sounds like you might not have a source parameter defined.

    Allan

  • epep Posts: 24Questions: 6Answers: 0

    Of course.

    I have just done it.

    Eberhard

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Thanks.

    The problem is this part in the code in your initEdit event handler:

        var Feld = editor.field('_100_1_a');
        Feld.update({ name: data._100_1_a });
    

    That is removing your default source of ['a', 'aa',...] and replacing it with that object, which is something that jQuery UI's auto complete library doesn't understand by the looks of it.

    Remove that update line the the source array would work as expected.

    Allan

  • epep Posts: 24Questions: 6Answers: 0

    Thanks very much for your solution.

    DataTables is a great library. Alas, I'm becomming too old for OO programming ...

    Eberhard

This discussion has been closed.