KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Search and paging options #1976

Open Abhishek opened this topic on on Mar 18, 2021 - 10 comments

Abhishek commented on Mar 18, 2021

Dear Team, I need a small information that is in the "Table" can I implement the search and paging features options.

Abhishek commented on Mar 18, 2021

Dear Team, I need a small information that is in the "Table" can I implement the search and paging features options.

KoolReport commented on Mar 18, 2021

It is possible. The Table has pagination options. You can put a textbox on top of table to let user key in the search term and submit. Base on the term, you can query data to feed into Table with pagination feature turned on.

Abhishek commented on Mar 18, 2021

Dear Team, If you don't mind can you provide me an example on how to implement the textbox as search option.

KoolReport commented on Mar 19, 2021

The best example are in your hand now. Like previous work you have done there is $startDatePicker, let consider it as a value from a textbox, and then you can use that value to insert into SQL query. The same is applied to search and table.

Abhishek commented on Mar 19, 2021

Respected Sir/Madam, As per your instruction I have used the text box as search option but unable to implement in query. I mean can you provide me an idea of how to pass the text value in to the query. As per I understood I have implement the code below.

<script>
<?php
if(isset($_POST['submit'])){
	$startDatePicker=$_POST['startDatePicker'];
$selected_val = $_POST['radioList'];  // Storing Selected Value In Variable
$startDatePickernew=date("d-m-Y", strtotime($startDatePicker) );
$textBox=$_POST['textBox'];
?>
//<script>
//alert('ddd');
//</script>

<?php
//echo "You have selected :".$selected_val;  // Displaying Selected Value
$countno = 1;
if($selected_val=="CallingDate")
{//echo '1'.$startDatePickernew;
echo 
Table::create([
"dataSource"=>$this->src("cloudkli_demo")->query("SELECT ce.custName AS PatientName,ce.custPhoneNumber AS PhoneNumber,ce.custServiceFor AS Treatment,DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y') AS CreatedDate,DATE_FORMAT(ce.custAppointmentDate, '%d-%m-%Y')As AppointmentDate,
DATE_FORMAT(ce.custStatusDate, '%d-%m-%Y') As CallBackDate,ce.custVistId AS VisitID,ce.custRemarks AS Remarks,
ce.callType AS Typeofcall,cr.replyName AS Reply,cs.statusName AS Status
FROM tblcustomerenquiries ce
LEFT JOIN tblcustomerreply cr ON ce.callType = cr.replyId 
LEFT JOIN tblcustomerstatus cs ON ce.custCustomerStatus = cs.statusId
WHERE ce.custVistId IS null AND DATE_FORMAT(ce.custCreatedDate, '%d-%m-%Y')='$startDatePickernew' 
or (ce.custName='$textBox' or ce.custPhoneNumber='$textBox')"),
Abhishek commented on Mar 19, 2021

Respected Sir/Madam, Please can you confirm that I have implement the code correctly as per you instruction. Please just a small confirmation.

Abhishek commented on Mar 20, 2021

Respected Sir/Madam, Please can you confirm that I have implement the code correctly as per you instruction. Please just a small confirmation.

KoolReport commented on Mar 20, 2021

That is the way. you get textbox value through $_POST and feed to the sql. Make sure that the sql is correct.

Abhishek commented on Mar 20, 2021

Actually I have small doubt that is when I search any data in the search box it need to be appear directly but in my case I need to enter the data in search bar and then after clicking on the submit button the data is getting retrieved. I hope that my question is clear.

Abhishek commented on Mar 20, 2021

Respected Sir/Madam, The below is the output of the above code which I have implemented for the search.

And when I enter the text in the search and then click on the submit button then the data is appearing correctly. So could you please show me an solution for the search option.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

None