DataTables Editor and plugin fnFilterOnReturn
DataTables Editor and plugin fnFilterOnReturn
I downloaded DataTables Editor today - Trial Mode - to try to integrate in my application. If I succeed I'll by a license.
Firsto problem I got is that Editor does not work with the plugin "fnFilterOnReturn" ( https://datatables.net/plug-ins/api/fnFilterOnReturn ). I got this error:
Uncaught TypeError: $datatable.DataTable(...).fnFilterOnReturn is not a function
If I start DataTable like this:
var table = $datatable.dataTable({
fnFilterOnReturn works BUT Editor does not.
If I start DataTable like this:
var table = $datatable.DataTable({
Editor works BUT fnFilterOnReturn does not.
As I use server side processing, it's really annoying to perform a serach on every KeyPress... this plugin to search only on Enter Key is a must have...
Is there a workaround to have both Editor and fnFilterOnReturn working on a DataTable simultaneously?
Best regards,
Sérgio Ávila
This question has an accepted answers - jump to answer
Answers
Update:
tried calling from using:
without success.. got this error:
table.fnFilterOnReturn is not a function
just remembering that I do have //cdn.datatables.net/plug-ins/1.10.19/api/fnFilterOnReturn.js loaded, witch works fine without Editor, and my datatable is now initializing with this:
table = $datatable.DataTable({
I thought that this call on fnInitComplete should work, but that wasn't the case.
Fortunately, I tried the following code, witch worked fine:
Now, using this code, my search input is searching only on Enter Key. Just don't know why the fnFilterOnReturn is not working as well.
Thanks anyway. Will continue here to fully integrate Editor in my admin panel.
Sérgio Ávila
fnFilterOnReturn
is a legacy API method so it needs to be initialised using the$().dataTable()
(note the lowercased
) method.What you could do is:
Its not ideal and really that plug-in should get updated to use the more modern API. Thanks for pointing that out.
I reckon the solution you've written above is probably better that using the workaround I've just written!
Allan