Custom Filtering Question
Custom Filtering Question
ricjustsaid
Posts: 3Questions: 0Answers: 0
Hey Allan, first of all thank you for writing DataTables - without a doubt it's the greatest jQuery table plugin out there!
Before I start, I'm going to admit that this is probably an unusual requirement for a project... I have DataTables set up using pipelining, and it works perfectly. My table has 6 columns of data being displayed, which is just a basic overview of the record. One column links to another page displaying the *full* and complete data, which consists of probably 15-20 different fields stored in a database. But anyways, onto the problem. I have an "Advanced Search" form on the same page as my table using DataTables, which allows the user to enter a series of criteria and filter down the records precisely.
The problem is that many of these fields/columns aren't existent in the table, and it doesn't seem to be possible to send these search parameters to my PHP script using DataTables. I can filter on the columns that exist in the table using fnFilter (and in fact, have done so on a different table completely unrelated to this project :P ), but I'm unsure on how to filter on columns not present in the table.
Any ideas would be hugely appreciated!
Before I start, I'm going to admit that this is probably an unusual requirement for a project... I have DataTables set up using pipelining, and it works perfectly. My table has 6 columns of data being displayed, which is just a basic overview of the record. One column links to another page displaying the *full* and complete data, which consists of probably 15-20 different fields stored in a database. But anyways, onto the problem. I have an "Advanced Search" form on the same page as my table using DataTables, which allows the user to enter a series of criteria and filter down the records precisely.
The problem is that many of these fields/columns aren't existent in the table, and it doesn't seem to be possible to send these search parameters to my PHP script using DataTables. I can filter on the columns that exist in the table using fnFilter (and in fact, have done so on a different table completely unrelated to this project :P ), but I'm unsure on how to filter on columns not present in the table.
Any ideas would be hugely appreciated!
This discussion has been closed.
Replies
With server-side processing you can two it two different ways:
1. Send your search string as a custom variable ( http://datatables.net/examples/server_side/custom_vars.html ) and do the sql where on that.
2. Modify your sql where to use sSearch from DataTables to search more than just the display columns.
Personally I'd use 1. if your search box is not the 'filter' box put into the page by DataTables, and 2. if it is.
Regards,
Allan