Integrating Grid++ Report Plugin into ThinkPHP5: A Step‑by‑Step Tutorial

This article walks through the complete process of integrating the Grid++ reporting plugin into a ThinkPHP5 project, covering environment setup, required JavaScript files, embedding the designer, controller implementation, and database configuration with clear code examples.

php Courses
php Courses
php Courses
Integrating Grid++ Report Plugin into ThinkPHP5: A Step‑by‑Step Tutorial

In order to use Grid++ for reporting within a ThinkPHP5 application, the author documented the integration process after finding limited resources online.

Environment : phpstudy, ThinkPHP5, Grid++ Report6.

1. Include required JavaScript files (placed in public/admin/js):

<script type="text/javascript" src="__STATIC__/admin/js/GRInstall.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/GRUtility.js"></script>
<script type="text/javascript" src="__STATIC__/admin/js/CreateControl.js"></script>

These three scripts constitute the Grid++ web‑side plugin.

2. Create the report in Grid++ : Follow the Grid++ UI to design the report; no additional code is required for this step.

3. Insert the designer plugin into a web page using the following script block:

<script type="text/javascript">
    // Load report definition and data
    CreateDisplayViewerEx("100%", "100%", "__STATIC__/grf/1a.grf", "__STATIC__/data/DataCenter.php?data=Student", true, "");
</script>

4. Write the controller method to render the view:

public function DisplayViewReport()
{
    return $this->fetch();
}

5. Adjust database connection in Data/mysql_GenXmlData.php by setting mysql_connect() and mysql_select_db() to match your own MySQL server and database name.

The example is intentionally simple, avoiding multi‑table queries to illustrate the basic integration steps.

For further details and visual guidance, refer to the original article linked at the end of the page.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

BackendPHPReportinggridThinkPHP5
php Courses
Written by

php Courses

php中文网's platform for the latest courses and technical articles, helping PHP learners advance quickly.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.