Custom link example with calling a custom function
<?php 
require_once '../../../../php/demo/tabs.php';
?>
<!DOCTYPE html>
<html>
  <head>
    <title>jqGrid PHP Demo</title>
    <link rel="stylesheet" type="text/css" media="screen" href="../../../../css/jquery-ui.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="../../../../css/trirand/ui.jqgrid.css" />
    <link rel="stylesheet" type="text/css" media="screen" href="../../../../css/ui.multiselect.css" />
    <style type="text">
        html, body {
        margin: 0;            /* Remove body margin/padding */
        padding: 0;
        overflow: hidden;    /* Remove scroll bars on browser window */
        font-size: 75%;
        }
        
    </style>
    <script src="../../../../js/jquery.min.js" type="text/javascript"></script>
    <script src="../../../../js/trirand/i18n/grid.locale-en.js" type="text/javascript"></script>
         <script src="../../../../js/trirand/jquery.jqGrid.min.js" type="text/javascript"></script> <script type="text/javascript">         
    $.jgrid.no_legacy_api = true;
    $.jgrid.useJSON = true;
    $.jgrid.defaults.width = "700";
    function MyLink( p1, p2)
    {
        alert( "p1= "+p1 + " , "+ "p2="+ p2);        
    }
    </script>
     
    <script src="../../../../js/jquery-ui.min.js" type="text/javascript"></script>
  </head>
  <body>
      <div>
          <?php include ("grid.php");?>
      </div>
      <br/>
      <?php tabs(array("grid.php"));?>
   </body>
</html>
grid.php.
<?php
require_once '../../jq-config.php';
// include the jqGrid Class
require_once ABSPATH."php/PHPSuito/jqGrid.php";
// include the driver class

// Create the jqGrid instance
$grid = new jqGridRender();
// Lets create the model manually and set the formatters
$Model = array(
    array(
"name"=>"ID","width"=>50),
    array(
"name"=>"PhotoFileName","width"=>100),
    array(
"name"=>"Photo","width"=>100,"formatter"=>"js:formatImage""unformat"=>"js:unformatImage"),
    array(
"name"=>"Rating","sorttype"=>"integer","formatter"=>"js:formatRating","unformat"=>"js:unformatRating""cellattr"=>"js:formatcell"),
    array(
"name"=>"Link","sorttype"=>"string","formatter"=>"js:formatLink"),    
);
// Let the grid create the model
$grid->setColModel($Model);
// Set grid option datatype to be local
$grid->setGridOptions(array("datatype"=>"local""width"=>400,"height"=>350));
//We can add data manually using arrays
$data = array();
for(
$i=0;$i<9;$i++)
{
    
$data[] = array("ID"=>$i+1,"PhotoFileName"=>($i+1).".jpg","Photo"=>($i+1).".jpg""Rating"=>rand(-20,30), "Link"=>"link".($i+1));
}
// Let put it using the callGridMethod
$grid->callGridMethod("#grid"'addRowData', array("ID",$data));
// We can put JS from php
$custom = <<<CUSTOM
function formatImage(cellValue, options, rowObject) {
    var imageHtml = "<img src='images/" + cellValue + "' originalValue='" + cellValue + "' />";
return imageHtml;
}
function unformatImage(cellValue, options, cellObject) {
    return $(cellObject.html()).attr("originalValue");
}
function formatRating(cellValue, options, rowObject) {
    var color = (parseInt(cellValue) > 0) ? "green" : "red";
    var cellHtml = "<span style='color:" + color + "' originalValue='" +
                   cellValue + "'>" + cellValue + "</span>";
    return cellHtml;
}
function unformatRating(cellValue, options, cellObject) {
    return $(cellObject.html()).attr("originalValue");
}
function formatcell(rowId, val, rawObject, cm, rdata) {
    var imageHtml = "style='background-color:red;";
return imageHtml;
}
function formatLink(cellValue, options, rowData) {
    return "<a href='#' onclick='MyLink("+rowData.ID+","+"\""+rowData.Photo+"\""+");'>"+cellValue+"</a>";
}
CUSTOM;
// Let set the code which is executed at end
$grid->setJSCode($custom);
$grid->renderGrid('#grid','#pager',truenullnulltrue,true);