This example demonstrate that jqGrid can work with array data like it is SQL one.
For this purpose we have created a special jqGrid Array driver called jqGridArray.
The only what is needed in case of working with PHP array data is to include the driver,
create the array connection and from this point you can work with array with SQL commands:


Available SQL command: SELECT, DISTINCT, FROM, WHERE, ORDER BY, LIMIT, OFFSET
Operators available : * =, <, >, <=, >=, <>, !=, IS, IS IN, IS NOT, IS NOT IN, LIKE, ILIKE, NOT LIKE, NOT ILIKE
Functions available in WHERE parameters : LOWER(var), UPPER(var), TRIM(var)

Limitation: Currently CRUD operations are not available:

Below is a simple example which demonstrates this:

<?php require_once '../../../jq-config.php'; // include the jqGrid Class require_once ABSPATH."php/jqGrid.php"; // include the driver class require_once ABSPATH."php/jqGridArray.php"; // create the array connection $conn = new jqGridArray(); // Create the jqGrid instance $grid = new jqGridRender($conn); // Create a random array data for ($i = 0; $i < 1000; $i++) { $data1[$i]['id'] = $i+1; $data1[$i]['foo'] = md5(rand(0, 10000)); $data1[$i]['bar'] = 'bar'.($i+1); } // Always you can use SELECT * FROM data1 $grid->SelectCommand = "SELECT id, foo, bar FROM data1"; $grid->dataType = 'json'; $grid->setPrimaryKeyId('id'); $grid->setColModel(); // Enable navigator $grid->setUrl('grid.php'); $grid->setGridOptions(array( "rowNum"=>10, "rowList"=>array(10,20,30), "sortname"=>"id" )); $grid->navigator = true; // Enable search $grid->setNavOptions('navigator', array("excel"=>false,"add"=>false,"edit"=>false,"del"=>false,"view"=>false,"csv"=>true, "pdf"=>true)); // Activate single search $grid->setNavOptions('search',array("multipleSearch"=>false)); // Enjoy $grid->renderGrid('#grid','#pager',true, null, null, true,true); ?>