KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

Partial Processing for Pagination #1703

Open Sherwin Gaddis opened this topic on on Nov 9 - 13 comments

Sherwin Gaddis commented on Nov 9

We have a large data set of 2200 records. Is it possible to use partial processing with pagination to limit the records brought back so that we don't have to wait 2 minutes for the screen to load the data?

Sebastian Morales commented on Nov 10

Sherwin, 2200 records should not be a problem. would you please post your report's setup and view php code here? Thanks!

Sherwin Gaddis commented on Nov 11

Thanks for the quick response! I am looking at the example https://www.koolreport.com/examples/reports/datagrid/server_processing/. What are the packages that need to be installed for this to work like the example code?

Here is my code. I know the query works. This is the exact query.

use koolreport\core\Utility as Util;
use koolreport\datagrid\DataTables;

DataTables::create([
        'name' => 'Patient Utilization',
            "dataSource"=>function() {
                return $this->src('results')
                ->query("
                    select concat(p.lname,' ' , p.fname) as name,
                    (select count(*) from openemr_postcalendar_events as e where e.pc_pid = p.pid and e.pc_facility = 3 and e.pc_eventDate between $oneYearAgo and CURDATE()) as patient_appt
                    from patient_data as p
                    where p.financial_review_exp > '2019-07-01' and not testing=1
                ");
            },
            'scope' => $this->params,
            "options" => [
                "searching" => true,
                "paging" => true,
                "pageLength" => 10,
            ],
            "showFooter"=>true,
            "serverSide"=>true,
    ]);

According to my IDE, the Utility is not used. I appreciate the help.

Sebastian Morales commented on Nov 12

Sherwin, Datagrid is all you need to use server processing to display data. Do you happen to use any framework like Laravel, Symphony, etc?

Sherwin Gaddis commented on Nov 12

No, we are not using a framework. Would it be better to use a framework like Symfony?

Sebastian Morales commented on Nov 12

It's good. Just I'm afraid a framework's form security could interfere with DataTables' xhr request. Pls add this option to see how it works:

    ...
    "serverSide"=>true,
    "method"=>'post', //add this
Sherwin Gaddis commented on Nov 12

I dropped this code inside of OpenEMR. https://github.com/openemr/openemr Adding the "method" => 'post' made the system take longer than 5 minutes to produce a page and there were no error messages in the log.

Thanks for your swift responses.

Sebastian Morales commented on Nov 13

Sherwin, please open the dev tool in your browser (F12), tab Network -> XHR, then refresh your Datagrid page to see xhr requests by the page. Let us know the response content of the requests.

Sherwin Gaddis commented on Nov 16

Sebastian, XHR is not registering on the Network tab at all. I checked the error log also. No errors there.

Sebastian Morales commented on Nov 16

Sherwin, pls open dev tool (F12) then refresh your page (F5) to check xhr request. Dev tool wouldn't register xhr request sent before its opening. Once you find xhr response please look for either tag <dt-ajax (in case there's no back end error) or any PHP error if there is. Cheers,

Sherwin Gaddis commented on Nov 16

Sebastian, No XHR for KoolReports is being executed.

Sebastian Morales commented on Nov 17

Well well well, there definitely must have been some javascript error when the table initialized that prevented it from sending xhr request for data. If you opened the dev tool's console tab I'm sure there would be some red error message.

Looking at the code again, I guess this is where the error came from:

    'name' => 'Patient Utilization',
    ...

Because we use a widget name as its client-side object id (so users could refer to it for its client-side functions if they need them) the name must be a correct javascript variable name which 'Patient Utilization' isn't. Please just remove the space and test your DataTables again. Cheers,

Sherwin Gaddis commented on Nov 18

I changed the 'name' to 'PatientUtilization'. It did not change anything. The system is not executing the ajax call to the database to get records. There are no error messages in the console and no errors logged in the PHP error log. Thanks for trying to assist.

Sebastian Morales commented on Nov 19

Pls send an email to support@koolphp.net regarding this topic. We will try to arrange a remote connection session for debugging this issue for you. Cheers,

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

QueryBuilder