where can I find the ajax call function for search box?
where can I find the ajax call function for search box?

I know there is ajax call while I typing in search box, in case of server side processing, the query is sent to server by ajax,
so where exactly can I find that ajax function corresponding to searchbox?
many thanks
This discussion has been closed.
Answers
just to clarify, i want to customize searchbox so that I can only search one column from database
really appreciated
This example shows one way to create your own event for the default search input.
http://live.datatables.net/jorexujo/1/edit
You can replace the
search()
API part withcolumn().search()
.Another option is to remove the global search input using the
dom
option and create your own input that usescolumn().search()
.Kevin
maybe some api for replacing the function from exiting searchbox?
i'd like to keep the existing searchbox where it is, but replacing the function is good idea.
i tried with searching:false, and found that removes searchbox.
is there any way we can keep searchbox but replacing its function?
This is another example of Kevin's that calls
off()
to remove the existing listeners - you can then apply your own. It came from this thread.Cheers,
Colin
Sorry, should have provided a more complete example. The first example I provided also uses
off()
. I modified it to just search column 0.http://live.datatables.net/jorexujo/25/edit
Here is the resulting code:
Kevin
thank you for all examples,
with this
} );
i somehow got it following error for console:
jquery.dataTables.min.js:40 Uncaught TypeError: Cannot read property 'length' of undefined
at wb (jquery.dataTables.min.js:40)
at jquery.dataTables.min.js:37
at i (jquery.dataTables.min.js:35)
at Object.success (jquery.dataTables.min.js:36)
at fire (jquery-3.3.1.js:3268)
at Object.fireWith [as resolveWith] (jquery-3.3.1.js:3398)
at done (jquery-3.3.1.js:9305)
at XMLHttpRequest.<anonymous> (jquery-3.3.1.js:9548)
this is error is from reponse:
{"error":"An SQL error occurred: SQLSTATE[IMSSP]: Tried to bind parameter number 65536. SQL Server supports a maximum of 2100 parameters."}
is this related to mssql server i'm using at back end?
Are you using server side processing, ie,
serverSide: true
?If so what are you using for the server script?
Kevin
yes, i am using serverSide:true
and i copied from ssp.class.php from example here https://github.com/DataTables/DataTablesSrc/blob/master/examples/server_side/scripts/ssp.class.php
the only thing is that Im using MSSQL SERVER 2012 at back end
the datatable loads correctly, it is the search ajax giving this error somehow, i have spent hours to figure what's wrong, but it guess it has something to do with syntax of MSSQL being different from MYSQL. but im not quite sure how to fix it yet.
at beginning, i thought the table has too many columns( actually only 150 columns), but same error still happens after i switch to small table with only 10 columns.
is there any way we can show the sql query from ssp.class.php ? i'm having hard time to figure out where the query has wrong, or maybe something else.
You could comment this line back in - it will give an JSON error, but you can ignore that while debugging.
One thing - that script is for MySQL. You'd need to modify it to work with SQL Server.
Allan