Hello,
First, sorry for my English, I’m French.
Well, I have a problem in my third level subgrid ( Hierarchy 3 levels subgrid).
– I can add a row and edit it in my first level.
– I can add a row and edit it in my second level (subgrid)
– But in my third level (sub subgrid), I can add a row, but only the field (id_detail) which binds the two tables is not filled. And the edit mode don’t work at all.
I compared my code with the original, and I don’t understand where is the problem.
Do you have an idea to solve my problem?
King regards,
First grid
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
<?php require_once '../PAS-config.php'; // include the jqGrid Class require_once "../php/PHPSuito/jqGrid.php"; // include the driver class require_once "../php/PHPSuito/DBdrivers/jqGridPdo.php"; // Déclaration de la class pour le calendrier require_once "../php/PHPSuito/jqCalendar.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 princip.<code>CustomerID</code>, princip.<code>Nom_PA</code>, princip.type, princip.<code>evenement</code>, princip.debut, princip.fin_prevue, princip.<code>timing</code>, princip.<code>bouclage</code>, princip.<code>mesure</code> FROM <code>princip</code> '; // Set the table to where you update the data $grid->table = 'princip'; // 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_PAS.php'); // Set some grid options $grid->setGridOptions(array( "height"=>"Auto", // Hauteur automatique du tableau "hoverrows"=>true, // highlight la ligne survolée "caption"=>"Plan d'Action Sécurité du TMV", // Titre du tableau "width"=>1300 , "rowNum"=>10, "sortname"=>"CustomerID" )); $grid->setColProperty('CustomerID', array("label"=>"Réf", "width"=>50, "editable"=>false)); $grid->setColProperty('Nom_PA', array("label"=>"Nom du PA", "width"=>90, "editable"=>true,"editrules"=>array("required"=>true))); $grid->setSelect("Nom_PA", "SELECT <code>nature_pa</code>,<code>nature_pa</code> FROM <code>menu_nature_pa</code> ORDER BY <code>nature_pa</code> ASC",false,true,true); $grid->setColProperty('type', array("label"=>"Type action", "width"=>120)); $grid->setSelect("type", "SELECT <code>type_liste</code>,<code>type_liste</code> FROM <code>menu_type</code> ORDER BY <code>type_liste</code> ASC",false,true,true); $grid->setColProperty('evenement', array("label"=>"Evènement", "edittype"=> 'textarea',"editoptions"=>array("style"=>"width:98%;"), "width"=>200, "editable"=>true)); $grid->setColProperty('timing', array("label"=>"Timing", "width"=>50)); $grid->setColProperty('obj', array("label"=>"Objectifs", "width"=>50)); $grid->setColProperty('mesure', array("label"=>"Mesure efficacité", "width"=>50)); // Champ "date de début prévue" $grid->setColProperty('debut',array("label"=>"Début prévue","align"=>"center", "width"=>90,"formatter"=>"date", // Défini le champ comme un champ ""date"" "formatoptions"=>array("srcformat"=>"Y-m-d","newformat"=>"d/m/Y"), // Défini le format d'affichage en jj/mm/aaaa "search"=>true )); // Autorise la recherche sur ce champ $grid->setDatepicker('debut', array("buttonIcon"=>true, 'changeMonth'=> true), true, true); // Active le Datepicker en mode bouton $grid->datearray = array('debut'); // Déclaration du champ contenant une date $grid->SetUserDate("d/m/Y"); // <---------------------------------------------> // Champ "date de fin prévue" $grid->setColProperty('fin_prevue', array("label"=>"Fin prévue","align"=>"center", "width"=>90,"formatter"=>"date", "formatoptions"=>array("srcformat"=>"Y-m-d","newformat"=>"d/m/Y"), // Défini le format d'affichage en jj/mm/aaaa "search"=>true)); // $grid->setColProperty('fin_prevue', array("formoptions"=>array("rowpos"=>4,"colpos"=>2))); $grid->setDatepicker('fin_prevue', array("buttonIcon"=>true, 'changeMonth'=> true), true, true); // Active le Datepicker en mode bouton $grid->datearray = array('fin_prevue'); // Déclaration du champ contenant une date $grid->SetUserDate("d/m/Y"); // <---------------------------------------------> $grid->setColProperty('bouclage', array("label"=>"Bouclage", "width"=>60)); $grid->setSelect("bouclage", "SELECT <code>bouclage</code>,<code>bouclage</code> FROM <code>menu_bouclage</code> ORDER BY bouclage ASC",false,true,true); // <---------------------------------------------> // fonction "Color background" conditionnelle d'une ligne $rowattr = <<<ROWATTR function (rd) { if (rd.Nom_PA == "PASMI") { return { "style": "background-color:#FF9999; background-image:none;" }; } else if (rd.Nom_PA == "ADAM") { return { "style": "background-color:#E6E6FF; background-image:none;" }; } } ROWATTR; $grid->setGridEvent('rowattr', $rowattr); // Fin de la fonction "Color background" conditionnelle d'une ligne $grid->setSubGridGrid("grid_PAS_sub.php"); // Enable navigator $grid->navigator = true; // Enable only editing $grid->setNavOptions('navigator', array("excel"=>true,"add"=>true,"edit"=>true,"del"=>false,"view"=>true)); $grid->setNavOptions('edit', array("height"=>'auto',"dataheight"=>"auto","width"=>'auto',"closeAfterEdit" => true)); // Paramètre du formulaire d'édition $grid->setNavOptions('view', array("height"=>'auto',"dataheight"=>"auto","width"=>'800')); $grid->setNavOptions('add', array("addCaption"=>"Nouvelle Action","closeAfterAdd"=>true,"height"=>'auto',"dataheight"=>"auto","width"=>'auto')); // Enjoy $grid->renderGrid('#grid','#pager',true, null, null, true,true); ?> |
subgrid
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
<!--?php require_once '../PAS-config.php'; // include the jqGrid Class require_once "../php/PHPSuito/jqGrid.php"; // include the driver class require_once "../php/PHPSuito/DBdrivers/jqGridPdo.php"; require_once "../php/PHPSuito/jqCalendar.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<br ?--> // By default we add to postData subgrid and rowid parameters in the main grid $oper = jqGridUtils::GetParam("oper"); $subtable = jqGridUtils::GetParam("subgrid"); $rowid = jqGridUtils::GetParam("rowid"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = "SELECT id_detail, CustomerID, OrderID, description, UO, unites, pilote, contributeur, commentair, date_modif, date_real, etat_avance, comment FROM <code>seconde</code> WHERE CustomerID = ?"; // set the ouput format to json $grid->dataType = 'json'; //$grid->setPrimaryKeyId('OrderID'); // Let the grid create the model $grid->setColModel(null,array(&$rowid)); // Set the url from where we obtain the data $grid->setUrl('grid_PAS_sub.php'); $grid->table = 'seconde'; // Set some grid options $grid->setGridOptions(array( "height"=>"Auto", // Hauteur automatique du tableau "hoverrows"=>true, // highlight la ligne survolée "caption"=>"détail Action", // Titre du tableau "width"=>1200, "rowNum"=>10, "sortname"=>"id_detail", "postData"=>array("subgrid"=>$subtable,"rowid"=>$rowid))); // Change some property of the field(s) $grid->setColProperty('OrderID', array("hidden"=>true)); $grid->setColProperty('CustomerID', array("hidden"=>true,"editable"=>false)); $grid->setColProperty('id_detail', array("label"=>"Réf détail", "width"=>60)); $grid->setColProperty('description', array("label"=>"Description Action", "edittype"=> 'textarea',"editoptions"=>array("style"=>"width:98%;"), "width"=>200, "editable"=>true)); $grid->setColProperty('pilote', array("label"=>"Pilote", "width"=>60)); $grid->setColProperty('contributeur', array("label"=>"Contributeur", "width"=>80)); $grid->setColProperty('commentair', array("label"=>"Com Contributeur", "edittype"=> 'textarea',"editoptions"=>array("style"=>"width:98%;"), "width"=>200, "editable"=>true)); $grid->setColProperty('comment', array("label"=>"Com Pilote", "edittype"=> 'textarea',"editoptions"=>array("style"=>"width:98%;"), "width"=>200, "editable"=>true)); // **************************************** //Champ date Datepicker $grid->setColProperty('date_modif', array("label"=>"Date modif","align"=>"center", "width"=>80,"formatter"=>"date", // Défini le champ comme un champ ""date"" "formatoptions"=>array("srcformat"=>"Y-m-d","newformat"=>"d/m/Y"), // Défini le format d'affichage en jj/mm/aaaa "search"=>true )); // Autorise la recherche sur ce champ $grid->setDatepicker('date_modif', array("buttonIcon"=>true, 'changeMonth'=> true), true, true); // Active le Datepicker en mode bouton $grid->datearray = array('date_modif'); // Déclaration du champ contenant une date $grid->SetUserDate("d/m/Y"); // Configuration de l'affichage de la date coté utilisateur // ------- $grid->setColProperty('date_real', array("label"=>"Date réalisation","align"=>"center", "width"=>80,"formatter"=>"date", // Défini le champ comme un champ ""date"" "formatoptions"=>array("srcformat"=>"Y-m-d","newformat"=>"d/m/Y"), // Défini le format d'affichage en jj/mm/aaaa "search"=>true)); // Autorise la recherche sur ce champ $grid->setDatepicker('date_real', array("buttonIcon"=>true, 'changeMonth'=> true), true, true); // Active le Datepicker en mode bouton $grid->datearray = array('date_real'); // Déclaration du champ contenant une date $grid->SetUserDate("d/m/Y"); // Configuration de l'affichage de la date coté utilisateur // **************************************** // champ avec menu déroulant $grid->setColProperty('etat_avance', array("label"=>"avancement", "width"=>40, "editable"=>true, "formatter"=>"integer", "formatoptions"=>array("elmprefix"=>"(*)", "suffix"=>" %",))); $grid->setSelect("etat_avance", "SELECT avance,avance FROM <code>menu_avancement</code> ORDER BY <code>avance</code> ASC ",false,true,true); $grid->setColProperty('UO', array("label"=>"UO/Pôle", "width"=>80)); $grid->setSelect("UO", "SELECT <code>pole</code>,<code>pole</code> FROM <code>menu_pole</code> ORDER BY pole ASC",false,true,true); $grid->setColProperty('unites', array("label"=>"Unités", "width"=>80)); $grid->setSelect("unites", "SELECT <code>unites</code>,<code>unites</code> FROM <code>menu_unite</code> ORDER BY unites ASC",false,true,true); // **************************************** // set a option when we add a record to insert a CustomerID too. $grid->setNavOptions("add",array("editData"=>array("CustomerID"=>$rowid))); $grid->setSubGridGrid ("grid_PAS_subsub.php"); $grid->navigator = true; $grid->setNavOptions('navigator', array("excel"=>false,"add"=>true,"edit"=>true,"del"=>false,"view"=>true)); $grid->setNavOptions('edit', array("height"=>'auto',"dataheight"=>"auto","width"=>'auto',"closeAfterEdit" => true)); // Paramètre du formulaire d'édition $grid->setNavOptions('add', array("CustomerID"=>$rowid, "addCaption"=>"Nouvelle Action","closeAfterAdd"=>true,"height"=>'auto',"dataheight"=>"auto","width"=>'auto')); // $grid->setNavOptions('add', array('editData'=>array("CustomerID"=>$rowid))); // Enjoy $subtable = $subtable."_t"; $pager = $subtable."_p"; $grid->renderGrid($subtable,$pager, true, null, array(&$rowid), true,true); ?> |
subsubgrid
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
<!--?php require_once '../PAS-config.php'; // include the jqGrid Class require_once "../php/PHPSuito/jqGrid.php"; // include the driver class require_once "../php/PHPSuito/DBdrivers/jqGridPdo.php"; // Déclaration de la class pour le calendrier require_once "../php/PHPSuito/jqCalendar.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<br ?--> // By default we add to postData subgrid and rowid parameters in the main grid $oper = jqGridUtils::GetParam("oper"); $subtable = jqGridUtils::GetParam("subgrid"); $rowid = jqGridUtils::GetParam("rowid"); // Create the jqGrid instance $grid = new jqGridRender($conn); // Write the SQL Query $grid->SelectCommand = "SELECT id_detail, id_l3, description_3, UO_3, unites_3, pilote_3, contributeur_3, commentair_3, date_modif_3, date_real_3, etat_avance_3, comment_3 FROM troisieme WHERE id_detail= ?"; // 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('grid_PAS_subsub.php'); $grid->table = 'troisieme'; // Set some grid options $grid->setGridOptions(array( "height"=>"Auto", // Hauteur automatique du tableau "hoverrows"=>true, // highlight la ligne survolée "width"=>980, "caption"=>"détail sous-Action", // Titre du tableau "rowNum"=>10, "sortname"=>"id_detail", "postData"=>array("subgrid"=>$subtable,"rowid"=>$rowid))); // Change some property of the field(s) $grid->setColProperty('id_detail', array("editable"=>true,"hidden"=>false)); //$grid->setNavOptions("add",array("editData"=>array("id_detail"=>$rowid))); $grid->navigator = true; $grid->setNavOptions('navigator', array("excel"=>false,"add"=>true,"edit"=>true,"del"=>false,"view"=>false)); $grid->setNavOptions('edit', array("height"=>'auto',"dataheight"=>"auto","width"=>'auto',"closeAfterEdit" => true)); // Paramètre du formulaire d'édition $grid->setNavOptions('add', array("id_detail"=>$rowid, "addCaption"=>"Nouvelle sous-Action","closeAfterAdd"=>true,"height"=>'auto',"dataheight"=>"auto","width"=>'auto')); // Enjoy $subtable = $subtable."_t"; $pager = $subtable."_p"; $grid->renderGrid($subtable,$pager, true, null, array(&$rowid), true,true); ?> |
Jqgrid PHP 5.1.0
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top