Sometimes there are situations where something is wrong and the code does not work in a way that we want. For this purpose we have introduced a mini debugger, which tell us waht is happen with the grid.

To enable this feature the public variable debug should be set to true.
When this variable is enabled a file named jqGrid.log is created in the directory where your script reside.
In order to ilustarte this we again will use our example.

There is no special requierment wheere to put the debug option. It should just be called after the grid is created.

Now the PHP code should look like this

<?php require_once 'jq-config.php'; // include the jqGrid Class require_once "php/jqGrid.php"; // include the PDO driver class require_once "php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Create the jqGrid instance $grid = new jqGrid($conn); // enable debugging $grid->debug = true; // Write the SQL Query $grid->SelectCommand = 'SELECT OrderID, OrderDate, CustomerID, Freight, ShipName FROM orders'; $grid->dataType = "json"; $grid->queryGrid(); ?>

After runnig the html file a file jqGrid.log will be created with the following structure:

Executed 2 query(s) - 2010-02-13 16:39:34
Array
(
    [0] => Array
        (
            [time] => 2010-02-13 16:39:34
            [query] => SELECT COUNT(*) AS COUNT  FROM orders
            [data] => 
            [types] => 
            [fields] => 
            [primary] => 
            [input] => 
        )

    [1] => Array
        (
            [time] => 2010-02-13 16:39:34
            [query] => SELECT OrderID, OrderDate, CustomerID, Freight, ShipName FROM orders ORDER BY OrderID asc LIMIT 0, 10
            [data] => 
            [types] => 
            [fields] => 
            [primary] => 
            [input] => 
        )

)

This tell us that when the script is called two queries are executed.
Below we will explain every item in the query.

  • [time] is the timestamp of the query execution
  • [query] is the executed query. If a parameters are speciefied the query will contain the placeholder ?
  • [data] is array with the actual values that are passed in the place of the parameters
  • [types] is array that contain the field types (like integer, string) when a CRUD operations are performed This is valid only when jqGridEdit and jqGridRender classes are used.
  • [fields] is array containing diffretent information for the fields when a CRUD operations are performed This is valid only when jqGridEdit and jqGridRender classes are used.
  • [primary] is a string which tell us the name of the paimary key when a CRUD operations are performed This is valid only when jqGridEdit and jqGridRender classes are used.
  • [input] is associative array with the input values (data to be inserted, updated, deleted) when a CRUD operations are performed This is valid only when jqGridEdit and jqGridRender classes are used.