React UI Components Documentation
React Server-Side Paging
This tutorial shows how to create a Server-Side Paging for jqxGrid with React. The data is loaded on demand which provides the opportunity to present a huge amount of data.
Overview
We will create our simple server with the powerful Node.js platform, we will handle our queries and get the data from the familiar Northwind database. For this purpose, we need to include a few plugins to achieve that we want - like express and mysql for our server script. About the Client-Side, we will use the jqxGrid on the React library. We assume that this tutorial is known and we will continue from this position with the next steps.
Getting Started
The next step is to install the desired plugins. For this purpose, we open the terminal and navigate to the root of the current project.
/root
/my-app
/node_modules
server.js
I. Let's install the express package. In the terminal use the command below:
npm install express
II. Install the mysql package. Enter the following command:
npm install mysql
Review of the current state
The package.json
file should have dependencies for the newly added plugins.
How to create it you can look at this.
Start our XAMPP server
We need to connect with our database
.
In our tutorial, we will use the Northwind database.
For this purpose we will use the XAMPP with the same success we could use WAMP or another alternative.
Here we will skip the steps of the installation of these platforms because we assume that this is known already.

We need to start the first two options - Apache and MySQL as in the image above. This is enough to proceed with the next steps. To create one fully working example.
Server-Side - Handling requests with Node.js
The prepared example with jqxGrid will make requests to the server with a bunch of extra arguments.
Important for us now are pagenum
and pagesize
.
Our goal is to send data to the client in small pieces that the client requests, and respond when the page number or page size is changed by the user.
All of this operation we will handle with the Node.js.
We will create a server.js
file that will do the mentioned above.
The file will be in one level up of the React my-app
folder.
In this file, we connect to the Northwind database.
Handling different requests as we create different queries and after that return data as a JSON object.
This object has two members "Rows" with an array of all records and the second one "TotalRows" with a value of count all records in number type.
The default port React project running is 3000
and for this purpose we will set the port of the Node.js server to the 4545
.
Client-Side - Visualizing the data in jqxGrid
We have a lot of examples in our React demos section, especially for the jqxGrid.
Which can be used to create the desired structure and to use the most suitable approach for us.
Also, we suppose that we already are familiar with the Create jQWidgets React App TSX tutorial.
Based on these points we will start directly with the editing.
Navigate to the root/my-app/src
folder.
Let's make the following changes:
App.tsx:
Summary
We use a lot of different technologies to achieve Server-Side Paging.
- XAMPP - to connect to the MySQL with the Northwind database
-
Node.js - to create a simplified server application
- express plugin - handling different routes
- mysql plugin - for SQL queries to the database
- React - our Client-Side technology
- jqxGrid - visualize the data from the database
Required Final Steps
We should run everything and we should have one fully working jqxGrid React example with Server-Side Paging. The XAMPP should be launched as we described before.
The next step is to run our Node.js server. Open the terminal with the root directory (/root/server.js) of our application and type:
node server.js
This will execute our server.js
file and our server will run.
Now we should open another terminal with the root (/root/my-app/) of our React project. Type the familiar command:
npm start
This should run our React project at the following port:
http://localhost:3000/
Final Result
