How can we do global search by using comma to all the columns
How can we do global search by using comma to all the columns
SandeepMurala
Posts: 48Questions: 13Answers: 0
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Answers
HI ,
I am using datatable server side scripting ,In that I am using
main.php
andserver.php
andssp.class.php
,inmain.php
I have written ajax by callingserver.php
,inserver.php
file I have written all my queries with conditions ,It is working fine as I expected ,
there is text box called ```search`` (global search),based on this I am able to do global search.
Here one thing I noticed when I do global search like
'India karnataka Bangalore'
(India-> countrie field,karnataka-> state field,Bangalore-> city field all are different fields ) I will get proper result like one record of Bangalore city , karnataka state and india countries . This is coming when I use normal
datatable
concept (without using server side scripting (server.php)),But when I am using
server side scripting (server.php)
I have to use,(comma)
like'India,karnataka,Bangalore'
I am getting mutlipe result like all india records and karnataka records and bangalore records ,it is not like which record have all this value , I think in this case it is applyingOR
in between the conditionsWhen I am using servre side script (server.php) how can I get exactly result ,
For better understanding https://datatables.net/examples/basic_init/zero_configuration.html
in that link if you search with
London Software Engineer
all Londonand
Software Engineer records only showing but when we using server side it not showing like that ,It is showing like all london records along with all Software Engineer records ,How can I fix this issue plz help on it what I have to do .
Thanks
Sandeep
This thread should help, it's asking the same thing.
Cheers,
Colin
@colin thanks for your valuble respones ,
I hope your are understood my problem ,I am new to this conecpt ,I am trying to learn more things here ,I went through your link ,but I did not get that ans. ,
Could you plz give some sample code or some path ,that is very usefull for me ,I spent lot of time on it but I failed to get the code ,
If you give that solution that is very helpfull and appriciated ..
Thanks
Sandeep
It's all in that thread I posted, I can't add any more. Feel free to post what you've done, we can take a look,
Colin
@colin ,Sorry for late response , I have been searching regarding my problem but I did not get ans anythere ,Then I have added the code which you have shared on link ,
that code I have added in
ssp.classs.php
here is my code kinldy check and respond where I did went wrong .
I am gettng this error like
Plz help on it and give me one solution ,that is soo appriciated .
I have been struggling from last few days but I failed to get the ANS.
Thanks
Sandeep
It's a SQL error, reporting that "ftl_obverse" is an unknown column. Can you run that query by hand? If so and it works, can you post that command and the output here.
Colin
@colin ,I have tried that one which you have given but it was not working for me ,
So I am sharing my code for global search ,In that one I can search multiple values like
Bangalore,Karnataka,India
In this senario I am getting not onlyBangalore,Karnataka,India
it is coming india related stats and Karnataka all cities and bangalore city ,But I need only
Bangalore,Karnataka,India
this record ,I think It should takeAND
condition ,Here is my Code from ss.class.php and
filter
function :Note :
This serach based on (, comma ) when we do multiple column search
Give me solution On it plz .
Thanks
Sandeep
Hi Sandeep,
The SSP demo class doesn't do "smart" searching in the same way as DataTables client-side does. On the client-side it will split the words up by white-space and then do a search across the row for those words in any order. On the server-side however, the full string for the search term needs to be present in one of the columns.
This is the code for how that works.
If you wanted it to behave more like the client-side, you would need to add a split on the whitespace and then loop over the resulting array, adding suitable search conditions.
I did actually implement that for the Editor PHP libraries once, and the code is still there, just commented out and you could use that as a basis for modifying SSP if you wanted.
Allan
@colin and @allan thanks for you valuable response ,
I have done this my self , after split the code from fundamental ,I did it ,
I want to share that code here bez you saved me guys so many times ,This code working for me as I expected ,
Thanks
Sandeep
Nice, thanks for reporting back,
Colin