Hello,
I have new problem. 😉
I try to use the “custom rows detail” function.
I can’t bind my master table and the “detail” table. The two tables use the same ID (“Matricule”) . The “Matricule” field is the primary key for the two tables, and is an unique varchar like: 1234678A.
How I can define this field in the WHERE property in detail.php query ?
PS: Sorry for my bad english.
King regards,
grid.php
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<!--?php require_once '../GK_connex.php'; // include the jqGrid Class require_once "../php/PHPSuito/jqGrid.php"; // include the driver class require_once "../php/PHPSuito/DBdrivers/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 jqGridDB::query($conn,"SET NAMES utf8"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = 'SELECT Matricule,date_eff, Agent_ID, Nom, Prenom, Genre, Code_Etb, lib_Etb, Division_geo, lib_RG, RG, dep_compt, Statut, Contrat, Type_contrat, Empl_repere, Qualif, CEGOS, Position, Grade, College FROM effectif';<br ?--> // Set output 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('grid2.php'); // Set some grid options $grid->setGridOptions(array( "rowNum"=>10, "height"=>"auto", "rowList"=>array(10,20,30), "sortname"=>"Matricule" )); $grid->setUserDate("d-m-Y"); $grid->setColProperty('date_eff', array("label"=>"date","align"=>"center", "width"=>40,"formatter"=>"date", "formatoptions"=>array("srcformat"=>"Y-m-d","newformat"=>"d/m/Y"), // Défini le format d'affichage en jj/mm/aaaa "search"=>true)); // Set the url from where we get the data $grid->setSubGridGrid('details.php'); $grid->navigator = true; $grid->setNavOptions('navigator', array("excel"=>true,"add"=>true,"edit"=>true,"del"=>true,"view"=>true, "search"=>true)); // Enjoy $grid->renderGrid('#grid','#pager',true, null, null, true,true); |
detail.php
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
<!--?php <br ?--> require_once '../GK_connex.php'; // include the jqGrid Class require_once "../php/PHPSuito/jqGrid.php"; // include the driver class require_once "../php/PHPSuito/DBdrivers/jqGridPdo.php"; // Connection to the server $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Tell the db that we use utf-8 jqGridDB::query($conn,"SET NAMES utf8"); $rowid = jqGridUtils::Strip($_REQUEST["rowid"]); //if(!$rowid) die("Missed parameters"); // Get details $SQL = "SELECT Matricule, DDN_viseo, date_dispo_init, Note_EIA, Pot_valide, mobilite_structu FROM coca_viseo WHERE Matricule='8406226G'"; $qres = jqGridDB::query($conn, $SQL); $result = jqGridDB::fetch_assoc($qres,$conn); $s = "<table><tbody>"; $s .= "<tr><td><b> Date de naissance</b></td><td>".$result["DDN_viseo"]; //$s .= "<td rowspan='9' valign='top'><img src='images/".trim($result["EmployeeID"]).".jpg'/></td></tr>"; $s .= "<td><b>Date de dispo initiale</b></td><td>".$result["date_dispo_init"]."</td></tr>"; $s .= "<tr><td><b>Note de l'EIA</b></td><td>".$result["Note_EIA"]."</td></tr>"; $s .= "<tr><td><b>Potentiel validé</b></td><td>".$result["Pot_valide"]."</td></tr>"; $s .= "<tr><td><b>Mobilié structurelle</b></td><td>".$result["mobilite_structu"]."</td></tr>"; $s .= "</tbody></table>"; "; echo $s; jqGridDB::closeCursor($qres); |
Jqgrid PHP 5.1.0
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top