Advanced search filters

Advanced search filters

ikac.ikaxikac.ikax Posts: 6Questions: 0Answers: 0
edited November 2009 in General
Hey guys!

I have been reading dozens of posts on this forum and yet didn't find answer to my prob. There are couple of similar, but since I'm new to datatables, I don't know if those can help me.

The problem is that I want, by the built-in search, to have some form with advanced search text boxes.
Now, I looked at this post (http://datatables.net/examples/server_side/custom_vars.html) , but I want to push those additional values if user clicks at button of advanced form, and then reload the table. Since I'm new, maybe sending blank values of advanced search by the common values of datatables is good enough?

Thanks,
Ikac

Replies

  • allanallan Posts: 61,822Questions: 1Answers: 10,127 Site admin
    Hi Ikac,

    I'm presuming that you are using server-side processing with DataTables here? With server-side processing the filtering is entirely under your control, with the server-side script (SQL statements). DataTables will pass you the user's search string as sSearch, which you can then use to perform the filter (one method for doing this is shown in my examples for the server-side script). Has you have noted you can send more information using custom variables to the server-side, which can then be combined into the SQL statement to make a complex search.

    So I think basically it comes down to the fact that you need to put the search information into the Ajax call, and then deal with it appropriately on the server-side.

    Does this answer your question?

    Regards,
    Allan
  • ikac.ikaxikac.ikax Posts: 6Questions: 0Answers: 0
    Yes, I'm using server-side processing, I forgot to mention.

    Well I'm starting to get the whole picture of this.

    Thanks a lot Allan!
    Ikac
  • ikac.ikaxikac.ikax Posts: 6Questions: 0Answers: 0
    Hey again :)!

    The thing that I tried yesterday is working, but I'm having a new problem.
    I don't want to let the user to use both searches, common datatable's and my advanced. So I disable common when I'm using advanced search. Then I want to reload the table, as if there is nothing in common search, and in filters. I tried with fnReloadAjax(), but it is not passing any parameters to server script.
    I assume the prob is in oSettings, but I didn't find the way to pass it as argument.

    Some suggestions?
    Ikac
  • allanallan Posts: 61,822Questions: 1Answers: 10,127 Site admin
    Hi Ikac,

    If you want to keep filtering enabled, but remove the standard DataTables filtering input element, just drop the 'f' from the sDom parameter: http://datatables.net/usage/options#sDom - example: http://datatables.net/examples/basic_init/dom.html

    Allan
  • ikac.ikaxikac.ikax Posts: 6Questions: 0Answers: 0
    Hey Allan,

    thanks for helping me,

    I just disabled it and erased its value, and tried to fnDraw() the table and it is sending sSearch value to server anyway. I just want to send advanced search values or common search value, not both, and to reset table values when sending it. I'm stuck, really.

    Thanks for helping,
    Ikac
  • allanallan Posts: 61,822Questions: 1Answers: 10,127 Site admin
    Hi Ikac,

    With the 'f' parameter out of sDom, you will see that the input element for the filtering isn't added to the page by DataTables. As such, sSearch can't be anything other than a blank string - so you could safely ignore that on the server-side.

    Allan
  • ikac.ikaxikac.ikax Posts: 6Questions: 0Answers: 0
    Hey Allan,

    Well I know about sDom, I managed to design my own shape of datatables, but that is static as I assume, because when you draw table, you must erase it and draw with another sDom options. Right?

    Ikac
  • ikac.ikaxikac.ikax Posts: 6Questions: 0Answers: 0
    Hey Allan,

    Nevermind, I found a way to solve the prob, I guess. Thanks for the help.

    Best regards,
    Ikac
This discussion has been closed.