I’ve been working quite a bit with the Zend Framework recently as well as jqgrid. I knew it would only be a matter of time before i would have to somehow integrate the two.

Here is how i did it.

View

 jQuery("#list2").jqGrid({url:'/filter/grid',datatype: "json",
 colNames:['CustomerID','Customer'],
 colModel:[ {name:'CustomerID',index:'CustomerID', width:100}, {name:'Customer',index:'Customer', width:550}],
 rowNum:10,
 rowList:[10,20,30],
 pager: '#pager2',
 sortname: 'CustomerID',
 viewrecords: true,
 sortorder: "desc",
 caption:"JSON Example"
 });
jQuery("#list2").jqGrid('navGrid','#pager2',{edit:false,add:false,del:false});

Controller

public function gridAction()
{
Zend_Registry::get('log')->info( __METHOD__ );
$this->_helper->viewRenderer->setNoRender();
$this->_helper->getHelper('layout')->disableLayout();

$sidx = $this->getRequest()->getParam('sidx');
$sord = $this->getRequest()->getParam('sord');
$page = $this->getRequest()->getParam('page');
$limit = $this->getRequest()->getParam('rows');

$count =  $this->filterService->getGridRowCount();

if( $count > 0 ) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages)
$page=$total_pages;

$start = $limit * $page - $limit;
if ($start<0)          	$start=0;         $row = $this->filterService->getGridData($sidx,$sord,$start,$limit);

$response['page'] = $page;
$response['total'] = $total_pages;
$response['records'] = $count;
$i=0;
foreach ($row as $r) {
$response['rows'][$i]['id']=$r['CustomerID']; //id
$response['rows'][$i]['cell']=array($r['CustomerID'],$r['Customer']);
$i++;
}
$this->_helper->json($response);

}

Model

public function getGridData($idx,$ord,$start,$limit)
{
$select = $this-&gt;db-&gt;select()
-&gt;distinct()
-&gt;from('rtp_filter', array('CustomerID'=&gt;'CustomerID', 'Customer'=&gt;'Customer'));

if ($idx!='')
$select-&gt;order($idx.' '.$ord);
$select-&gt;limit($limit,$start);
$result = $this-&gt;db-&gt;fetchAll($select);
return $result;
}

public function getGridRowCount()
{
$select = $this-&gt;db-&gt;select()
-&gt;distinct()
-&gt;from('rtp_filter', '*');
$rowset = $select-&gt;query()-&gt;fetchAll();
return count($rowset);
}