$(window).resize(function() { $('#eidgrid').fluidGrid({base:'#ui-dialog-title-eid_dialog', offset:-25}); }); CUSTOM; $grid->setJSCode($custom); $oper = jqGridUtils::GetParam("oper"); if($oper == "pdf") { $grid->setPdfOptions(array( "header"=>true, "margin_top"=>25, "page_orientation"=>"P", "header_logo"=>"../../../../../images/Logo_450x123_24bit_color.jpg", // set logo image width "header_logo_width"=>45, //header title "header_title"=>" Snare/Windows Event ID Report" )); } // Enjoy $summaryrows=array("Seen"=>array("Seen"=>"SUM")); $grid->renderGrid('#eidgrid','#eidpager',true, $summaryrows, null, true,true); $conn = null; ?>
function get_main_grid() { global $myconn, $customers; $myconn->query("SET NAMES utf8"); //execute the query specifical to your database $sth = $myconn->prepare('SELECT CustomerID, CompanyName, ContactName, Phone, City FROM customers'); $sth->execute(); // get the data as array. Nothe the the customer array // is passed in the select command $customers = $sth->fetchAll(PDO::FETCH_ASSOC); // end of custom code //var_dump($customers); // create the array connection $conn = new jqGridArray(); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT * FROM customers'; // Set the table to where you update the data $grid->table = 'customers'; // Set output format to json $grid->dataType = 'json'; $grid->setPrimaryKeyId("CustomerID"); // Let the grid create the model $grid->setColModel(); // Set the url from where we obtain the data $grid->setUrl('grid.php'); // Set some grid options $grid->setGridOptions(array("rowNum" => 10, "height" => 250, "rowList" => array(10, 20, 30), "sortname" => "CustomerID")); $grid->setColProperty('CustomerID', array("label" => "ID", "width" => 50)); $grid->setSubGridGrid("subgrid.php"); // Enable navigator $grid->navigator = true; // Enable only editing $grid->setNavOptions('navigator', array("excel" => false, "add" => false, "edit" => false, "del" => false, "view" => false)); // Enjoy $grid->renderGrid('#grid', '#pager', true, null, null, true, true); }
// include the driver class require_once ABSPATH . "php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT CustomerID, CompanyName, ContactName, Phone, City FROM customers'; // Set the table to where you update the data $grid->table = 'customers'; // Set output format to json $grid->dataType = 'json'; // Let the grid create the model $grid->setPrimaryKeyId('CustomerID'); $grid->setColModel(); // Set the url from where we obtain the data $grid->setUrl('grid.php'); // Set some grid options $grid->setGridOptions(array("rowNum" => 10, "height" => 250, "gridview" => false, "rowList" => array(10, 20, 30), "sortname" => "CustomerID")); $grid->setColProperty('CustomerID', array("label" => "ID", "width" => 50)); // Set the parameters for the subgrid $grid->setSubGrid("subgrid.php", array('OrderID', 'RequiredDate', 'ShipName', 'ShipCity', 'Freight'), array(60, 120, 150, 100, 70), array('left', 'left', 'left', 'left', 'right')); // Enable navigator $grid->navigator = true; // Enable only editing $grid->setNavOptions('navigator', array("excel" => false, "add" => false, "edit" => false, "del" => false, "view" => false)); // Enjoy $grid->renderGrid('#grid', '#pager', true, null, null, true, true); $conn = null;
\$("#mne_dialog").ready(function(){ // Some magic to set the proper width of the grid inside a Modal window var modalWidth = \$("#mne_dialog").width(); var modalHeight = \$("#mne_dialog").height() - 52; \$('#mnegrid').jqGrid('setGridWidth',modalWidth); \$('#mnegrid').jqGrid('setGridHeight',modalHeight); \$('#mnegrid').fluidGrid({base:'#mne_dialog', offset:-25}); }); //--------------------------------------------------------------- // END: Mnemonic Select Dialog //--------------------------------------------------------------- }); \$(window).resize(function() { \$('#mnegrid').fluidGrid({base:'#ui-dialog-title-mne_dialog', offset:-25}); }); CUSTOM; $grid->setJSCode($custom); $oper = jqGridUtils::GetParam("oper"); if ($oper == "pdf") { $grid->setPdfOptions(array("header" => true, "margin_top" => 25, "page_orientation" => "P", "header_logo" => "../../../../../images/Logo_450x123_24bit_color.jpg", "header_logo_width" => 45, "header_title" => " Mnemonics Report")); } // Enjoy $summaryrows = array("Seen" => array("Seen" => "SUM")); $grid->renderGrid('#mnegrid', '#mnepager', true, $summaryrows, null, true, true); $conn = null;
$grid->setUrl('detail.php'); // Set some grid options $grid->setGridOptions(array("rowNum" => 10, "footerrow" => true, "userDataOnFooter" => true, "sortname" => "OrderID", "height" => 110)); // Change some property of the field(s) $grid->setColProperty("RequiredDate", array("formatter" => "date", "formatoptions" => array("srcformat" => "Y-m-d H:i:s", "newformat" => "m/d/Y"), "search" => false)); // on beforeshow form when add we get the customer id and set it for posting $beforeshow = <<<BEFORE function(formid) { var srow = jQuery("#grid").jqGrid('getGridParam','selrow'); if(srow) { \tvar gridrow = jQuery("#grid").jqGrid('getRowData',srow); \t\$("#CustomerID",formid).val(gridrow.CustomerID); } } BEFORE; // disable the CRUD buttons when we initialy load the grid $initgrid = <<<INIT jQuery("#add_detail").addClass("ui-state-disabled"); jQuery("#edit_detail").addClass("ui-state-disabled"); jQuery("#del_detail").addClass("ui-state-disabled"); INIT; $grid->setJSCode($initgrid); $grid->setColProperty("EmployeeID", array("hidden" => false, "width" => 20)); $grid->navigator = true; $grid->setNavOptions('navigator', array("excel" => true, "add" => true, "edit" => true, "del" => true, "view" => false)); $grid->setNavEvent('add', 'beforeShowForm', $beforeshow); // Enjoy $summaryrow = array("Freight" => array("Freight" => "SUM")); $grid->renderGrid("#detail", "#pgdetail", true, $summaryrow, array((int) $rowid), true, true); $conn = null;
require_once ABSPATH . "php/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN, DB_USER, DB_PASSWORD); // Tell the db that we use utf-8 $conn->query("SET NAMES utf8"); // Get the needed parameters passed from the main grid $subtable = jqGridUtils::Strip($_REQUEST["subgrid"]); $rowid = jqGridUtils::Strip($_REQUEST["rowid"]); if (!$subtable && !$rowid) { die("Missed parameters"); } // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = "SELECT OrderID, ProductID, Quantity, UnitPrice FROM order_details WHERE OrderID=?"; // set the ouput format to json $grid->dataType = 'json'; // Let the grid create the model $grid->setColModel(null, array(&$rowid)); // Set the url from where we obtain the data $grid->setUrl('subsubgrid.php'); // Set some grid options $grid->setGridOptions(array("width" => 480, "rowNum" => 10, "sortname" => "OrderID", "height" => 'auto', "postData" => array("subgrid" => $subtable, "rowid" => $rowid))); // Change some property of the field(s) $grid->navigator = true; $grid->setNavOptions('navigator', array("excel" => false, "add" => false, "edit" => false, "del" => false, "view" => false)); // Enjoy $subtable = $subtable . "_t"; $pager = $subtable . "_p"; $grid->renderGrid($subtable, $pager, true, null, array(&$rowid), true, true); $conn = null;
$(window).resize(function() { $('#prggrid').fluidGrid({base:'#ui-dialog-title-prg_dialog', offset:-25}); }); CUSTOM; $grid->setJSCode($custom); $oper = jqGridUtils::GetParam("oper"); if($oper == "pdf") { $grid->setPdfOptions(array( "header"=>true, "margin_top"=>25, "page_orientation"=>"P", "header_logo"=>"../../../../../images/Logo_450x123_24bit_color.jpg", // set logo image width "header_logo_width"=>45, //header title "header_title"=>" Programs Report" )); } // Enjoy $summaryrows=array("Seen"=>array("Seen"=>"SUM")); $grid->renderGrid('#prggrid','#prgpager',true, $summaryrows, null, true,true); $conn = null; ?>
{ $('#hostsgrid').fluidGrid({base:'#ui-dialog-title-host_dialog', offset:-25}); }); CUSTOM; $grid->setJSCode($custom); $oper = jqGridUtils::GetParam("oper"); if($oper == "pdf") { $grid->setPdfOptions(array( "header"=>true, "margin_top"=>25, "page_orientation"=>"P", "header_logo"=>"../../../../../images/Logo_450x123_24bit_color.jpg", // set logo image width "header_logo_width"=>45, //header title "header_title"=>" Hosts Report" )); } // Enjoy # $summaryrows=array("Seen"=>array("Seen"=>"SUM")); $grid->renderGrid('#hostsgrid','#hostspager',true, null , array($securi), true,true); $conn = null; ?>
<?php require_once '../../../jq-config.php'; //require_once ABSPATH."php/jqUtils.php"; require_once ABSPATH . "php/jqGrid.php"; //require_once ABSPATH."php/jqGridArray.php"; //require_once ABSPATH."php/jqGridPdo.php"; require_once ABSPATH . "php/jqChart.php"; ini_set("display_errors", "1"); // get your data manually and build the array $myconn = new PDO(DB_DSN, DB_USER, DB_PASSWORD); $myconn->query("SET NAMES utf8"); $sth = $myconn->prepare("SELECT CustomerID, SUM(Freight) AS Freight FROM orders WHERE (CustomerID ='BERGS' OR CustomerID ='WHITC' ) AND OrderDate BETWEEN '1997-01-01' AND '1997-12-31' GROUP BY CustomerID"); $sth->execute(); $customers = $sth->fetchAll(PDO::FETCH_ASSOC); $chart = new jqChart(); $chart->setChartOptions(array("defaultSeriesType" => "bar"))->setTitle(array('text' => 'Freight 1997'))->setyAxis(array("title" => array("text" => "Freight")))->setJSCode("mychart = chart;")->setTooltip(array("formatter" => "function(){return '<b>'+ this.series.name +'</b><br/>'+this.x +': '+ this.y;}"))->addSeries($customers[0]['CustomerID'], array($customers[0]['Freight']))->addSeries($customers[1]['CustomerID'], array($customers[1]['Freight'])); echo $chart->renderChart('', true, 700, 350); // building the grid $grid = new jqGridRender(null); $grid->setColModel(array(array("name" => "CustomerID", "key" => true), array("name" => "Freight"))); $grid->setUrl('grid.php'); $grid->setGridOptions(array("datatype" => "local", "data" => $customers)); $grid->navigator = false; $grid->renderGrid('#grid', '#pager', true, null, null, false, false); // Enjoy
$choices = array("Yes" => "Yes", "No" => "No"); // $grid->setSelect("disabled", $choices , false, false, true, array(""=>"All")); $grid->setSelect("disabled", $choices, false, true, true, array("" => "All")); $grid->navigator = true; $grid->setNavOptions('navigator', array("pdf" => true, "excel" => true, "add" => true, "edit" => false, "del" => false, "view" => false, "search" => true)); $grid->setNavOptions('edit', array("width" => "auto", "height" => "auto", "dataheight" => "auto", "top" => 200, "left" => 200)); $grid->setNavOptions('add', array("width" => "auto", "height" => "auto", "dataheight" => "auto", "top" => 200, "left" => 200)); $custom = <<<CUSTOM var modalWidth = \$("#portlet_Email_Alerts").width(); var modalHeight = \$("#portlet_Email_Alerts").height() - 52; \$('#triggergrid').jqGrid('setGridWidth',modalWidth); \$('#triggergrid').jqGrid('setGridHeight',modalHeight); \$('#triggergrid').fluidGrid({base:'#portlet_Email_Alerts', offset:-25}); \$(window).resize(function() { \$('#triggergrid').fluidGrid({base:'#portlet_Email_Alerts', offset:-25}); }); CUSTOM; $grid->setJSCode($custom); $oper = jqGridUtils::GetParam("oper"); if ($oper == "pdf") { $grid->setPdfOptions(array("header" => true, "margin_top" => 25, "page_orientation" => "P", "header_logo" => "../../../../../images/Logo_450x123_24bit_color.jpg", "header_logo_width" => 45, "header_title" => " Alerts Report")); } // Enjoy $grid->renderGrid('#triggergrid', '#triggerpager', true, null, null, true, true); $conn = null;
$grid->setGridOptions(array("rowNum" => 18, "sortname" => "id", "sortorder" => "asc", "altRows" => true, "rowList" => array(20, 40, 60, 75, 100), "forceFit" => true)); $choices = array("search_history" => "Search History", "graph_history" => "Graph History"); $grid->setSelect("spanid", $choices, false, true, true, array("" => "All")); $grid->navigator = true; $grid->setNavOptions('navigator', array("pdf" => true, "excel" => true, "add" => true, "edit" => false, "del" => false, "view" => false, "search" => true)); $grid->setNavOptions('edit', array("width" => "auto", "height" => "auto", "dataheight" => "auto", "top" => 200, "left" => 200)); $grid->setNavOptions('add', array("width" => "auto", "height" => "auto", "dataheight" => "auto", "top" => 200, "left" => 200)); $custom = <<<CUSTOM var modalWidth = \$("#portlet_Edit_Favorites").width(); var modalHeight = \$("#portlet_Edit_Favorites").height() - 52; \$('#favorites_grid').jqGrid('setGridWidth',modalWidth); \$('#favorites_grid').jqGrid('setGridHeight',modalHeight); \$('#favorites_grid').fluidGrid({base:'#portlet_Edit_Favorites', offset:-25}); \$(window).resize(function() { \$('#favorites_grid').fluidGrid({base:'#portlet_Edit_Favorites', offset:-25}); }); CUSTOM; $grid->setJSCode($custom); $oper = jqGridUtils::GetParam("oper"); if ($oper == "pdf") { $grid->setPdfOptions(array("header" => true, "margin_top" => 25, "page_orientation" => "P", "header_logo" => "../../../../../images/Logo_450x123_24bit_color.jpg", "header_logo_width" => 45, "header_title" => " Alerts Report")); } // Enjoy $grid->renderGrid('#favorites_grid', '#favorites_pager', true, null, null, true, true); $conn = null;
$orders = $sth->fetchAll(PDO::FETCH_ASSOC); // end of custom code if (count($orders) == 0) { return "[]"; } // create the array connection $conn = new jqGridArray(); if (!$subtable && !$rowid) { die("Missed parameters"); } // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = "SELECT * FROM orders"; // set the ouput format to json $grid->dataType = 'json'; // Let the grid create the model $grid->setColModel(); // Set the url from where we obtain the data $grid->setUrl('subgrid.php'); // Set some grid options $grid->setGridOptions(array("width" => 540, "rowNum" => 10, "sortname" => "OrderID", "height" => 110, "postData" => array("subgrid" => $subtable, "rowid" => $rowid))); // Change some property of the field(s) $grid->setColProperty("RequiredDate", array("formatter" => "date", "formatoptions" => array("srcformat" => "Y-m-d H:i:s", "newformat" => "m/d/Y"), "search" => false)); $grid->navigator = true; $grid->setNavOptions('navigator', array("excel" => false, "add" => false, "edit" => false, "del" => false, "view" => false)); // Enjoy $subtable = $subtable . "_t"; $pager = $subtable . "_p"; $grid->renderGrid($subtable, $pager, true, null, null, true, true); $conn = null;