I have a form which also is linked to company names. I would like to have an autocomplete on the input field for company names.
Is it possible and how?
I'm not sure what you mean by "the rest of datatables"? That plug-in is used in Editor by including it and then using type: 'autocomplete' for the Editor field in question.
Uncaught TypeError: $(...).autocomplete is not a function
at f.create (editor.autoComplete.js:58)
at f.Field._typeFn (dataTables.editor.min.js:20)
at f.Field (dataTables.editor.min.js:11)
at f.add (dataTables.editor.min.js:34)
at f.add (dataTables.editor.min.js:34)
at f._constructor (dataTables.editor.min.js:63)
at new f (dataTables.editor.min.js:8)
at HTMLDocument.<anonymous> (datatable_script.js:23)
at i (datatables.min.js:14)
at Object.fireWith [as resolveWith] (datatables.min.js:14)
Answers
Yes it is possible. There is an integration plug-in for jQuery AutoComplete and Editor.
There are also integration options for Select2 and Selectize if you prefer them.
Allan
This is what I am looking for, but how do you add this plug in file to the rest of datatables?
I'm not sure what you mean by "the rest of datatables"? That plug-in is used in Editor by including it and then using
type: 'autocomplete'
for the Editor field in question.Allan
Sorry I meant how do I add it to editor?
Here is what I have. If I remove the type and opts parts, the editor works.
Editor JS
index.php
The error that I get is:
Did you include both the Plug-in code and the external libraries under
includes
?Kevin
I did, I have
I think you are missing the actual plugin code. Go here:
https://editor.datatables.net/plug-ins/field-type/editor.autoComplete#Plug-in-code
Click the
Javascript
link to download the plugin code to add to your web page.Kevin
I already have it in there
Could you try adding the plug-in after you load Editor. It shouldn't actually matter any more, but it certainly used to.
Failing that, can you give me a link to your page so I can check it out and debug it directly please?
Thanks,
Allan
I did that and I got this
It sounds like it isn't seeing your AutoComplete include for some reason. Possibly jQuery is being loaded more than once?
However, as I say, if you could give us a link to the page I'll be able to take a look and say exactly what is going wrong.
Thanks,
Allan
I will pm you the page Allan