Skip to content

Instantly share code, notes, and snippets.

@blanchette89
Created April 5, 2019 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blanchette89/e3bed7dc6b9540a825c819411af61ddd to your computer and use it in GitHub Desktop.
Save blanchette89/e3bed7dc6b9540a825c819411af61ddd to your computer and use it in GitHub Desktop.
PHP Grid
<?php
session_start();
//==================================================
// PHP GRID CONFIGURATION
//==================================================
include("/var/www/html/commun/phpgrid/lib/inc/jqgrid_dist.php");
error_reporting(0);
$inipath = php_ini_loaded_file();
$db_conf = array(
"type" => "xxxxxxxxxx",
"server" => "xxxxxxxxxx",
"user" => "xxxxxxxxxx",
"password" => "xxxxxxxxxx",
"database" => "xxxxxxxxxx"
);
//==================================================
// GRID CONSULTATION
//==================================================
$g = new jqgrid($db_conf);
$g->set_actions(array( "add"=>true, "edit"=>true,) );
// ***********************************
// TABLE SUPPORT
// ***********************************
$SQL = "SELECT SaisieWebSupportPK, NomDemandeur FROM SaisieWebSupport";
$g->table = "SaisieWebSupport";
$g->select_command = $SQL;
// ************ SaisieWebSupportPK
$col = array();
$col["title"] = "SaisieWebSupportPK"; // caption of column, can use HTML tags too
$col["name"] = "SaisieWebSupportPK"; // grid column name, same as db field or alias from sql
$col["hidden"] = true;
$cols[] = $col;
// ************ NomDemandeur
$col = array();
$col["title"] = "Demandeur"; // caption of column, can use HTML tags too
$col["name"] = "NomDemandeur"; // grid column name, same as db field or alias from sql
$col["editable"] = true;
$col["editrules"] = array("required"=>true);
$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>
<!-- JQUERRY -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<!-- php grid -->
<link rel="stylesheet" href="https://desiphp.csbf.qc.ca/phpgrid/lib/js/themes/csbf/jquery-ui.custom.css"></link>
<link rel="stylesheet" href="_fonts/ui.jqgrid.css"></link>
<script src="https://desiphp.csbf.qc.ca/phpgrid/lib/js/jqgrid/js/i18n/grid.locale-fr.js" type="text/javascript"></script>
<script src="https://desiphp.csbf.qc.ca/phpgrid/lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="https://desiphp.csbf.qc.ca/phpgrid/lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
</head>
<body>
<!---------------- MODIFIABLE ----------------->
<div class="row">
<div class=" col-1" align="left"></div>
<div class=" col-10" align="left">
<br> <?php echo $out;?>
</div>
<div class=" col-1" align="left"></div>
</div>
<!---------------- MODIFIABLE ----------------->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment