Architecture and class overview
Concept of the component¶
Conceptually Guriddo jqGrid PHP is not 100% PHP component. In order grid to work it is needed additionally to use (setup) JavaScript and HTML code. This mean that the developer should have some knowledge of HTML and JavaScript
The component is created with the mean that it should be flexible and to be integrated in any php project.
The main features for the flexibility are:
-
We do not create our connection in database, but use a connection that already exists. This is a very flexible approach in complex applications where the connection to the database had already been created and any additional connection require more memory.
-
The Javascript and CSS files should be set manually to the page where the grid will be loaded. This way with just minimal coding we save additional memory to load the script every time the grid is created especially in case where there are a two or more grids in one page.
-
The grid support all popular Databases servers
Classes Overview¶
jqGrid for PHP is designed in a way that allows it to be integrated in any framework or architecture, without compromising any of its features. In order to achieve this, we have separated the component into four classes - each of them provides functionality that is convenient in different contexts.
In addition to that, each class inherits the properties of its base class, so that the base features will be available to you at any time.
Below is the list of classes:
Grid Class (jqGrid.php)
Grid Export Class (Export.php)
Grid Edit Class (Edit.php)
Grid Render Class (Render.php)
Hierarchy and description¶
Here is the hierarchy of the classes
jqGrid (Utils, Logger)
|
- Export (Pdf, Csv, Excel, Utils)
|
- Edit (Validator, Utils)
|
-Render (Autocomplete, Calendar, Utils)
As can be seen any grid class include additional classes to provide certain functinality
jqGrid¶
jqGrid is the base class and provides basic grid functionalities such as:
- Fetch and send data from the server to the grid in different formats - json and xml
- Sorting
- Paging
- Searching
- Working with dates
- Simple Subgrid
- Logging
Again with this the class uses the common Utils class which contain helper functions.
Export¶
The Export class extend jqGrid class and is responsible to do server side exports to Excel, Pdf, Csv and Html formats.
Note
is important to note that the class uses two external libraries to do export to Excel and Pdf.
For the export to native excel and html formats class uses PhpSpereadsheet component.
To be able to do export to excel, this component should be installed separately See Installing packages for exporting
For the export to native pdf format export class uses TcPdf component
To be able to do export to pdf, this component should be installed separately See Installing packages for exporting
Edit¶
Edit class extend the Export class and provides editing capabilities such as:
- inserting
- updating
- deleting
- validating data before CRUD
- sanitation of data
to the database (know as CRUD) using transactions where possible. All this is done automatically without to write any additional code.
Again with this the class can be configured to process records to different tables before and after the CRUD to the main table.
The class uses the Validation class to do validation and sanitation of data
Render¶
The Render class extends all classes and provides all grid features plus automatic generation of Javascript and HTML placeholders required by the grid. In this respect, Render is the most advanced class and requires the minimal amount of coding, however in certain situations you may find Grid and Edit more convenient to use based on the context.
The Render class uses two additional classes Autocomplete (both Bootstrap 5 and jqQuery UI ) and Calender Datepicker (Both Bootstrap 5 and jQuery UI) to provide functionalities for automatic suggestions while you type into the field and open an interactive calendar in a small overlay just with one line of code.