Third-party JavaScript components can be integrated into a PHPRunner application without replacing the generated page. The same general approach works for data grids, charts, editors, calendars and many other browser-based components.
The integration usually has five parts:
- Add the component’s JavaScript and CSS files to the project.
- Add a container to the page where the component will be displayed.
- Make the required data available to JavaScript.
- Initialize the component after the page is ready.
- Add only the CSS needed to make the component fit the rest of the application.
In this tutorial we will use Tabulator, a JavaScript data-grid component, as a practical example. The important part is the integration pattern rather than Tabulator itself.
1. Add the third-party files
Download Tabulator from its installation page.
For a traditional browser-based integration, Tabulator provides both JavaScript and CSS files. Copy the files you need into your PHPRunner project’s source folder so they will be available in the generated application.
This example assumes that the files are available at:
- css/tabulator.min.css
- js/tabulator.min.js
Third-party libraries change over time, so always check the current documentation for file names, dependencies and API changes when adapting this example to a newer version.
2. Add a container in Page Designer
Open the List page in Page Designer. Remove any page elements you do not need and insert a Code Snippet into the container where you want the third-party component to appear.
The snippet has two jobs: load the component’s CSS and JavaScript files and create an HTML element where Tabulator will render the table.
PHP
C#
The example-table element is simply a placeholder. Tabulator will use it when the component is initialized.
3. Prepare the data on the server
Next, retrieve the data that will be displayed and pass it to JavaScript. Add the following code to the Before Display event of the same List page.
This example uses tables from the Northwind database. Replace the query with one appropriate for your own database.
PHP
C#
The database query can be much simpler if necessary. For example:
The important line is setProxyValue(). It makes the server-side data available to the JavaScript code running on the page.
4. Initialize the component
Open the JavaScript OnLoad event of the same List page.
First, retrieve the data passed from the server. Then create the Tabulator object and tell it which HTML element should contain the table.
Change the column titles and field names to match the data returned by your query.
Understanding the integration pattern
Although this example uses Tabulator, very little of the PHPRunner-specific code is actually related to Tabulator.
The reusable pattern is:
- Load the library. Add the JavaScript and CSS files required by the component.
- Create a container. Add an HTML element where the component can render itself.
- Prepare the data. Use PHPRunner server-side events and the Database API to retrieve any required data.
- Pass data to JavaScript. Use setProxyValue() when server-side data needs to be available in the browser.
- Initialize the component. Use JavaScript OnLoad so the component starts after the page and its container are available.
This pattern can be used with many third-party components, including specialized grids, charts, editors, visualization libraries and other JavaScript controls.
Keep third-party code isolated
When integrating an external component, avoid replacing more of the generated PHPRunner page than necessary. Keep the component inside its own container and limit custom CSS to that component whenever possible.
This makes the project easier to maintain because PHPRunner continues to manage the surrounding application structure, navigation, authentication and other generated functionality while the external library handles only the specialized interface you added.
Also keep in mind that third-party libraries have their own release cycles. The PHPRunner integration technique shown here remains the same, but individual JavaScript options, methods and file names may change. Check the component’s current documentation before updating an older implementation.


Very interesting. Has anyone tried add PHPGrid to a PHPRunner application? I was how well it would integrate.