Server Side Editing with jqxGrid using PHP and MySQL
This help topic shows how to implement server-side editing with the jqxGrid widget. The Grid will request data from the server when it is initialized. The server-side script is going to deliver the data records in JSON format depending. We will obtain the data from Northwind Database and especially from the Employees table. You can download the Northwind database .sql script here and run it into MySQL to create the database.
You can download the Northwind database .sql script here
and run it into MySQL to create the database. When the user edits the value of a Grid cell, the Grid will make another request to the server containing the updated row's data. The server-side script will then update the MySQL Database.
The first thing we need to do is create the file we’ll connect with. We’ll call this file connect.php
Now we need to create the file that will run the query and bring the data so our Grid can be populated. We will call the file data.php.
In the above code, we check whether there's an update parameter. If there is, we send an UPDATE command to the MySQL Database. The UPDATE command includes the new cell values of the updated record.
To enable the editing, we need to include the jqxgrid.edit.js file and also to set the Grid's editable property to true. In the source object's initialization, we set the updaterow member to a function which makes an ajax call to the server containing the update row.
The updaterow function is automatically called by the jqxGrid widget when the user edits the value of a Grid cell.