I'm trying to setup a report which shows a table, which enables you to search by only 1 specified column in the database table. I'm using Server Processing, as the DB table contains 6 million rows. Currently I'm using the built in Search box which appears when using the Server Processing table from the Kool Report examples page, however the problem is this uses the input to searches all columns, not just one specified column.
Is there a way to configure the search box to only use one Table Column? If there isn't, how to do connect my input box to the existing searching method?
Below is the code for generating the Server Processing table.
<?php
use \koolreport\core\Utility as Util;
use \koolreport\datagrid\DataTables;
?>
<style>
.dataTables_paginate.paging_input {
padding: 0 !important;
}
.dataTables_info,
.dataTables_paginate.paging_input span,
.dataTables_length label,
.dataTables_filter label {
padding-top: 5px !important;
padding-bottom: 5px !important;
}
.dataTables_length label,
.dataTables_filter label {
margin: 0 20px !important;
}
</style>
<div class="report-content">
<div class="text-center">
<h1>Summary of Councils</h1>
<p class="lead">
Summary of Councils using Server Processing
</p>
</div>
<i class="fa fa-arrow-down" style="font-size:24px;"></i>
<div style="margin-top:20px;">
<?php
DataTables::create(array(
'name' => 'DataTable1',
'dataSource' => function() {
return $this->src('delv')
->query('
SELECT
tblsourcesupplier.DelvRef,
tblsourcetype.SourceType,
tblsupplierinvoice.TotalInvoiceAmount,
(tblsupplierinvoice.TotalInvoiceAmount) + (tblsupplierinvoice.Penalty) + (tblsupplierinvoice.Interest) AS ClaimValue,
YEAR(paymentdate) AS PaymentYear
FROM
Delv.tblsupplierinvoice
INNER JOIN
tblsourcesupplier ON tblsourcesupplier.ID = tblsupplierinvoice.SupplierID
LEFT OUTER JOIN
tblsource ON tblsource.id = tblsourcesupplier.sourceid
LEFT OUTER JOIN
tblsourcelocation ON tblsourcelocation.id = tblsource.locationid
LEFT OUTER JOIN
tblsourcetype ON tblsourcetype.ID = tblsource.SourceType
WHERE
PaymentDate >= "2015-04-01"
AND PaymentDate < DATE_ADD(CURDATE(), INTERVAL - 1 YEAR)
AND TimetoPayInvoice > 30
');
// ->query("select concat(e.first_name, ' ', e.last_name) as emp_name,
// s.* from salaries s left join employees e on s.emp_no = e.emp_no");
},
'scope' => $this->params,
"options" => array(
"searching" => true,
"paging" => true,
"colReorder" => true,
"order" => [],
"ordering" => false,
"pageLength" => 25,
"pagingType" => "input",
"dom" => '<"top"ipfl<"clear">>rt<"bottom"ipfl<"clear">>'
// "dom" => '<"top"iflp<"clear">>rt<"bottom"ip<"clear">>'
),
// "columns"=>array(
// "customerName" => array("label" => "Customer"),
// "productLine" => array("label" => "Category"),
// "productName" => array("label" => "Product"),
// ),
"showFooter"=>true,
"serverSide"=>true,
// "method"=>'post', //default method = 'get',
"searchOnEnter" => true,
"searchMode" => "or"
));
?>
</div>