Server side paginating, sSearch not working
Server side paginating, sSearch not working
I'm working with a large database so I have to use this example http://datatables.net/release-datatables/examples/data_sources/server_side.html. THe problem is that some of the data coming from the database has to be manipulated and will no longer be the same on the output. To make it clear, an example:
$aColumns = array( 'id_product', 'id_category');
Once I get the id_product, Ill output $row[] = getProduct(id_product); At the end, I'll print the name of the product on the table instead of its ID. My problem is that sSearch doesnt work properly, since it will be looking for strings LIKE id_product on the table and not the name. To make it clear:
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
$aColumns[$i] will be id_product and $_GET['sSearch'] will be a string. In the end, they will never match, right? That's the problem. Is there a way to make the sSearch lookin within the datatable already processed ? Meaning, it will look within the product name (string) and not for its ID on the php/server-side.
Thanks in advance for your help.
$aColumns = array( 'id_product', 'id_category');
Once I get the id_product, Ill output $row[] = getProduct(id_product); At the end, I'll print the name of the product on the table instead of its ID. My problem is that sSearch doesnt work properly, since it will be looking for strings LIKE id_product on the table and not the name. To make it clear:
$sWhere .= $aColumns[$i]." LIKE '%".mysql_real_escape_string( $_GET['sSearch'] )."%' OR ";
$aColumns[$i] will be id_product and $_GET['sSearch'] will be a string. In the end, they will never match, right? That's the problem. Is there a way to make the sSearch lookin within the datatable already processed ? Meaning, it will look within the product name (string) and not for its ID on the php/server-side.
Thanks in advance for your help.
This discussion has been closed.