<?php
include_once("../../config.php");
include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
$db_conf = array(
"type" => PHPGRID_DBTYPE,
"server" => PHPGRID_DBHOST,
"user" => PHPGRID_DBUSER,
"password" => PHPGRID_DBPASS,
"database" => PHPGRID_DBNAME
);
$g = new jqgrid($db_conf);
$opt = array();
$opt["rowNum"] = 10;
$opt["sortname"] = 'id';
$opt["sortorder"] = "desc";
$opt["caption"] = "Invoice Data";
$opt["autowidth"] = true;
$opt["multiselect"] = true;
$opt["altRows"] = true;
$opt["altclass"] = "myAltRowClass";
$opt["rowactions"] = true;
$opt["export"] = array("format"=>"pdf", "filename"=>"my-file", "sheetname"=>"test");
$g->set_options($opt);
$g->set_actions(array(
"add"=>false,
"edit"=>true,
"delete"=>true,
"rowactions"=>true,
"showhidecolumns"=>true,
"export"=>true,
"autofilter" => true,
"search" => "advance"
)
);
$g->select_command = "SELECT i.id, invdate , c.name,
i.note, i.total, i.closed FROM invheader i
INNER JOIN clients c ON c.client_id = i.client_id";
$g->table = "invheader";
$col = array();
$col["title"] = "Id";
$col["name"] = "id";
$col["width"] = "15";
$cols[] = $col;
$col = array();
$col["title"] = "Client";
$col["name"] = "name";
$col["dbname"] = "LOWER(name)";
$col["width"] = "100";
$col["editable"] = false;
$col["align"] = "center";
$cols[] = $col;
$col = array();
$col["title"] = "Note";
$col["name"] = "note";
$col["sortable"] = false;
$col["search"] = false;
$col["editable"] = true;
$col["edittype"] = "textarea";
$col["editoptions"] = array("rows"=>2, "cols"=>20);
$col["hidden"] = true;
$col["editrules"] = array("edithidden"=>true);
$cols[] = $col;
$col = array();
$col["title"] = "Date";
$col["name"] = "invdate";
$col["width"] = "50";
$col["editable"] = true;
$col["editoptions"] = array("size"=>20);
$col["editrules"] = array("required"=>true);
$col["formatter"] = "date";
$cols[] = $col;
$col = array();
$col["title"] = "Total";
$col["name"] = "total";
$col["width"] = "50";
$col["editable"] = true;
$col["editoptions"] = array("value"=>'10');
"edittype"] = "select";
"editoptions"] = array("value"=>'10:$10;20:$20;30:$30;40:$40;50:$50');
$cols[] = $col;
$col = array();
$col["title"] = "Closed";
$col["name"] = "closed";
$col["width"] = "50";
$col["editable"] = true;
$col["edittype"] = "checkbox";
$col["editoptions"] = array("value"=>"Yes:No");
$cols[] = $col;
$col = array();
$col["title"] = "Details";
$col["name"] = "view_more";
$col["width"] = "30";
$col["align"] = "center";
$col["search"] = false;
$col["sortable"] = false;
$col["link"] = "http://localhost/?id={id}";
$col["linkoptions"] = "target='_blank'";
$col["default"] = "View More";
$cols[] = $col;
$g->set_columns($cols);
$out = $g->render("list1");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/themes/redmond/jquery-ui.custom.css"></link>
<link rel="stylesheet" type="text/css" media="screen" href="../../lib/js/jqgrid/css/ui.jqgrid.css"></link>
<script src="../../lib/js/jquery.min.js" type="text/javascript"></script>
<script src="../../lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="../../lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="../../lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
<link href="//cdn.jsdelivr.net/gh/wenzhixin/multiple-select@1.2.1/multiple-select.css" rel="stylesheet" />
<script src="//cdn.jsdelivr.net/gh/wenzhixin/multiple-select@1.2.1/multiple-select.js"></script>
</head>
<body>
<style>
.myAltRowClass { background-color: #F1F1F1; background-image: url(''); }
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight
{
background: #fbec88 url("images/ui-bg_flat_55_fbec88_40x100.png") repeat-x scroll 50% 50% !important;
}
</style>
<div style="margin:10px">
<?php echo $out?>
</div>
</body>
</html>