Hello,
I have a problem in the search mode. Usually I have no problem in search mode with a datepicker . But today I want use a datetimepicker. Everything is Ok in add or edit mode. I have a problem only with the search mode. When I choose my datetime field, the datetime window don’t appear.
Thank for your help.
Kind Regards,
PS: Sorry for my bad english
index page:
|
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 |
QSE REX-AT &nbsp; &nbsp; <!--- !--> <script src="../../js/jquery.min.js" type="text/javascript"></script> <script src="../../js/trirand/i18n/grid.locale-fr.js" type="text/javascript"></script> <script src="../../js/trirand/jquery.jqGrid.min.js" type="text/javascript"></script><script type="text/javascript">// <![CDATA[ $.jgrid.no_legacy_api = true; $.jgrid.useJSON = true; $.jgrid.defaults.width = "1200"; // ]]></script> <script src="../../js/jquery-ui.min.js" type="text/javascript"></script> <script src="../../js/jquery-ui-timepicker-addon.js" type="text/javascript"></script> <!-- tableau dynamique généré par jqgrid --> <!--?php include ("grid_rex_at.php");?--> <!-- Chargement du tableau --> <!-- fin du tableau dynamique --> |
Grid page:
|
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 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 |
<!--?php // Load des parametres de connexion require_once '../rex_at-config.php'; // Load des Class jqGrid require_once "../../php/PHPSuito/jqGrid.php"; // Load des paramétres PDO pour jqGrid require_once "../../php/PHPSuito/DBdrivers/jqGridPdo.php"; require_once "../../php/PHPSuito/jqCalendar.php"; // Load des paramétres français pour jqGrid require_once "../../php/PHPSuito/External/tcpdf/config/lang/fra.php"; mysql_set_charset('utf8'); // Connexion au serveur $conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD); // Déclaration du format UTF-8 de la BDD $conn->query("SET NAMES utf8");</p> <p> // Création d'une instance jqGrid<br ?--> $grid = new jqGridRender($conn); // Load de la requête SQL $grid->SelectCommand = 'SELECT id_at, type, date_at, uo_poles, unites, description, commentaires, nom, prenom, CP, jeune_embauche, arret, duree_arret, code1, code2 , code3, lesion, siege, epi, DPA_trait, DPA_valid FROM rex_at'; // Déclaration de la table MaJ $grid->table = 'rex_at'; // Définition d'une clé primaire $grid->setPrimaryKeyId("id_at"); $grid->serialKey = false; //Déclaration du format d'échange en json $grid->dataType = 'json'; // Déclaration du model du grid $grid->setColModel(); // Déclaration du fichier origine des données $grid->setUrl('grid_rex_at.php'); // Déclaration d'autres options $grid->setGridOptions(array( "caption"=>"Saisie REX des AT TMV", // Titre du tableau "rowNum"=>15, // Nombre de lignes par défaut à afficher "rowList"=>array(20,35,50), // Déclaration du nombres de lignes affichables "sortname"=>"date_at", // Déclaration du tri par défaut "sortorder"=>"desc", // Ordre de tri des lignes "width"=>1900, // Largeur du tableau en px "height"=>"Auto", // Hauteur automatique du tableau "hoverrows"=>true // highlight la ligne survolée )); // **************************************** // Règle d'édition des champs par défaut $grid->setColProperty('id_at', array("editoptions"=>array("readonly"=>true))); $grid->setColProperty('id_at', array("hidden"=>true)); $grid->setColProperty('type', array("label"=>"Type", "width"=>70, "align"=>"center", "editable"=>true)); $grid->setColProperty('uo_poles', array("label"=>"UO/Pôles", "width"=>90, "align"=>"center", "editable"=>true, "classes"=>"cvteste")); $grid->setColProperty('unites', array("label"=>"Unités", "width"=>90, "align"=>"left", "editable"=>true)); $grid->setColProperty('nom', array("label"=>"Nom", "width"=>90, "align"=>"left", "editable"=>true)); $grid->setColProperty('prenom', array("label"=>"Prénom", "width"=>70, "align"=>"left", "editable"=>true)); $grid->setColProperty('CP', array("label"=>"Num CP", "width"=>60, "align"=>"center", "editable"=>true)); $grid->setColProperty('jeune_embauche', array("label"=>"J-emb", "align"=>"center", "width"=>40, "editable"=>true)); $grid->setColProperty('arret', array("label"=>"Arrêt", "width"=>25, "align"=>"center", "editable"=>true)); $grid->setColProperty('lesion', array("label"=>"Lésion", "width"=>60, "editable"=>true)); $grid->setColProperty('duree_arret', array("label"=>"Durée arrêt", "width"=>60, "align"=>"center", "editable"=>true,"formatter"=>"integer", "formatoptions"=>array("suffix"=>" jours"))); $grid->setColProperty('siege', array("label"=>"Siège", "width"=>40, "align"=>"center", "editable"=>true)); $grid->setColProperty('epi', array("label"=>"EPI", "width"=>20, "align"=>"center", "editable"=>true)); $grid->setColProperty('DPA_trait', array("label"=>"Traite DPA", "width"=>50, "align"=>"center", "editable"=>true, "formatter"=>"integer", "formatoptions"=>array("suffix"=>" jours"))); $grid->setColProperty('DPA_valid', array("label"=>"Valid DPA", "width"=>50, "align"=>"center", "editable"=>true, "formatter"=>"integer", "formatoptions"=>array("suffix"=>" jours"))); // **************************************** // règle d'édition des champs dropdown $grid->setColProperty('code2', array("edittype"=>"select","label"=>"Codage N2", "width"=>110, "align"=>"left","editoptions"=>array("value"=>" :Select"))); $grid->setColProperty('code1', array("edittype"=>"select", "label"=>"Codage N1", "width"=>110, "align"=>"left","editoptions"=>array("value"=>" :Select"))); $grid->setColProperty('code3', array("edittype"=>"select", "label"=>"Codage N3", "width"=>110, "align"=>"left","editoptions"=>array("value"=>" :Select"))); $grid->setSelect("type", "SELECT champ_type, champ_type FROM drop_type_at ORDER BY champ_type ASC",false,true,true); $grid->setSelect("uo_poles", "SELECT pole, pole FROM menu_pole ORDER BY pole ASC",false,true,true); $grid->setSelect("unites", "SELECT unite, unite FROM <code>menu_unite</code> ORDER BY <code>unite</code> ASC ",false,true,true); $grid->setSelect("lesion", "SELECT <code>lesion</code>,<code>lesion</code> FROM <code>drop_lesion</code> ORDER BY <code>lesion</code> ASC",false,true,true); $grid->setSelect("siege", "SELECT <code>siege</code>,<code>siege</code> FROM <code>drop_siege</code> ORDER BY <code>siege</code> ASC",false,true,true); $grid->setSelect("jeune_embauche", "SELECT Choix,Choix FROM drop_choix_o_n ORDER BY Choix ASC",false,true,true); $grid->setSelect("arret", "SELECT Choix,Choix FROM drop_choix_o_n ORDER BY Choix ASC",false,true,true); $grid->setSelect("epi", "SELECT Choix,Choix FROM drop_choix_o_n ORDER BY Choix ASC",false,true,true); // **************************************** // Champ en zone de texte $grid->setColProperty('description', array("label"=>"Description", "edittype"=> 'textarea',"editoptions"=>array("rows"=>4, "cols"=>50, "maxlength"=>255, "width"=>120), "width"=>200, "editable"=>true)); $grid->setColProperty('commentaires', array("label"=>"Commentaires", "edittype"=> 'textarea',"editoptions"=>array("rows"=>4, "cols"=>50, "maxlength"=>255, "width"=>120), "width"=>100, "editable"=>true)); // **************************************** // Option d'édition Time datepicker $grid->setColProperty('date_at', array("formatter"=>"date", "label"=>"Date événement","align"=>"center", "width"=>100, "editable"=>true, "formatoptions"=>array("reformatAfterEdit"=>true, "srcformat"=>"Y-m-d H:i:s", "newformat"=>"m/d/Y H:i"), "editoptions"=>array("dataInit"=> "js:function(elm){setTimeout(function(){ jQuery(elm).datetimepicker({dateFormat:'mm/dd/yy'}); jQuery('.ui-datepicker').css({'font-size':'75%'}); },200);}") )); //$grid->datearray = array('date_at'); // Déclaration du champ contenant une date $grid->setDbTime('Y-m-d H:i:s'); $grid->setUserTime("d/m/Y H:i"); // **************************************** // Fonction de génération des menus déroulants en cascade $beforeshowadd = <<< BEFORESHOW function(formid) { // jQuery.ajax({ url: 'drop_N1.php', dataType: 'json', async : false, // envoi q:1 dans le cas d'ajout ou de modification drop_N1.php data: {q:1}, data: {z:1}, success : function(response) { var t="Select"; jQuery.each(response, function(i,item) { t += ""+item.value+""; }); jQuery("#code1",formid).html("").append(t); } }); jQuery("#code2",formid).html("Select"); } BEFORESHOW; $beforeshowedit = <<< BEFORESHOW2 function(formid) { var sr = jQuery("#grid").jqGrid('getGridParam','selrow'); var selc = jQuery("#grid").jqGrid('getCell',sr,'code1'); jQuery.ajax({ url: 'drop_N1.php', dataType: 'json', async : false, // Ne pas envoyer q en cas d'ajout ou de modif success : function(response) { var t=""; jQuery.each(response, function(i,item) { if( selc == item.id) { t += ""+item.value+""; } else { t += ""+item.value+""; } }); jQuery("#code1",formid).html("").append(t); } }); // Prend la valeur du menu déroulant 1 var cntryval = $("#code1",formid).val(); jQuery("#code2",formid).html("Select"); if(cntryval) { // Si la valeur est trouvée, utilise AJAX pour obtenir les valeurs de Niv 2 // SVP regarder le fichier drop_N2.php jQuery.ajax({ url: 'drop_N2.php', dataType: 'json', data: {q:cntryval}, success : function(response) { var t="", sv=""; if(sr) { // récupére le menu N2 dans le Grid sv = jQuery("#grid").jqGrid('getCell',sr,'code2'); jQuery.each(response, function(i,item) { t += ""+item.value+""; }); // vide la selection et ajoute la nouvelle valeur jQuery("#code2",formid).html("").append(t); if(sv) { // sélectionne la valeur du menu N2 jQuery("#code2",formid).val(sv).removeAttr("disabled"); } } } }); } else { jQuery("#code2",formid).attr("disabled","disabled"); } var sr3 = jQuery("#grid").jqGrid('getGridParam','selrow'); var selc3 = jQuery("#grid").jqGrid('getCell',sr,'code2'); jQuery.ajax({ url: 'drop_N2.php', dataType: 'json', async : false, // Ne pas envoyer q en cas d'ajout ou de modif success : function(response) { var t3=""; jQuery.each(response, function(i,item) { if( selc3 == item.id) { t3 += ""+item.value+""; } else { t3 += ""+item.value+""; } }); jQuery("#code2",formid).html("").append(t); } }); // Prend la valeur du menu déroulant 2 var N3val = $("#code2",formid).val(); // var N3val = "Sol glissant"; jQuery("#code3",formid).html("Select"); if(N3val) { // Si la valeur est trouvée, utilise AJAX pour obtenir les valeurs de Niv 3 // SVP regarder le fichier drop_N3.php jQuery.ajax({ url: 'drop_N3.php', dataType: 'json', data: {z:N3val}, success : function(response) { var t3="", sv3=""; if(sr3) { // récupére le menu 3 dans le Grid sv3 = jQuery("#grid").jqGrid('getCell',sr3,'code3'); jQuery.each(response, function(i,item) { t3 += ""+item.value+""; }); // vide la selection et ajoute la nouvelle valeur jQuery("#code3",formid).html("").append(t3); if(sv3) { // sélectionne la valeur du menu N2 jQuery("#code3",formid).val(sv3).removeAttr("disabled"); } } } }); } else { jQuery("#code3",formid).attr("disabled","disabled"); } // fin de test menu lvl 3 } BEFORESHOW2; // Avec cet événement nous lions un changement au niveau du premier dropdown // Si une nouvelle valeur est choisi, nous faisons un appel AJAX pour avoir les valeurs du second dropdown lié au premier // Notez que cet événement doit être exécutée une seule fois si le formulaire est construit. $initform = <<< INITFORM function(formid) { jQuery("#code1",formid).change(function(e) { var cntryval = $(this).val(); if(cntryval) { jQuery("#code2",formid).html(""); jQuery.ajax({ url: 'drop_N2.php', dataType: 'json', data: {q:cntryval}, success : function(response) { var t=""; jQuery.each(response, function(i,item) { t += ""+item.value+""; }); jQuery("#code2",formid).append(t).removeAttr("disabled"); } }); } }); jQuery("#code2",formid).change(function(e) { var N3val = $(this).val(); if(N3val) { jQuery("#code3",formid).html(""); jQuery.ajax({ url: 'drop_N3.php', dataType: 'json', data: {z:N3val}, success : function(response) { var t3=""; jQuery.each(response, function(i,item) { t3 += ""+item.value+""; }); jQuery("#code3",formid).append(t3).removeAttr("disabled"); } }); } }); // fin de test menu lvl 3 } INITFORM; // ***************** Fin du script des menus en cascade *********************** // **************************************** // Parametrage des export Excel et PDF $grid->exportfile = 'Export_retard_tmv.xls'; // Définition du nom du fichier d'export Excel $oper = jqGridUtils::GetParam("oper"); // Parametre d'exportation PDF if($oper == "pdf") { $grid->setPdfOptions(array( "page_orientation"=>"L", // Orientation de la page en paysage "L" ou portrait "P" "header"=>true, // Activation d'un entête "margin_top"=>20, // Déclaration d'une en-tete de haut de page "margin_bottom"=>0, // Déclaration d'une en-tete de bas de page "margin_footer"=>5, "header_logo"=>"logo.gif", // Nom d'un logo dans répertioire PDF php/ tcpdf "header_logo_width"=>20, //Déclaration de la largeur du logo "header_title"=>"Export retard sortie de site", // Titre de l'en-tête "shrink_cell"=>false, // Activation/Desactivation du tassement des valeurs "encoding" => "UTF-8", // Encodage UTF-8 "reprint_grid_header"=>true, // Affichage des titres de colonnes sur chaque page "header_string"=>"Technicentre de Villeneuve" // Texte d'en-tête à imprimer )); } //********************************* // **************************************** // Configuration du navigateur $grid->navigator = true; // Activation des options d'édition $grid->setNavOptions('navigator', array("excel"=>true,"add"=>true,"edit"=>true,"del"=>true,"view"=>true, "search"=>true)); // Fermeture de la fenetre d'édition apres validation $grid->setNavOptions('edit',array("closeAfterEdit"=>true,"editCaption"=>"MaJ Action","height"=>'auto',"dataheight"=>"auto","width"=>'1000',"top"=>'50', "left"=>'100',"bSubmit"=>"Update", "viewPagerButtons"=>false)); $grid->setNavOptions('add',array("closeAfterEdit"=>true,"editCaption"=>"Nouvelle action","height"=>'auto',"dataheight"=>"auto","width"=>'1000',"top"=>'50', "left"=>'100',"bSubmit"=>"Update", "viewPagerButtons"=>false)); $grid->renderGrid('#grid','#pager',true, null, null, true,true); $conn = null; ?> |
Jqgrid PHP 5.1.0
Copyright 2014 TriRand LtdAll Rights ReservedRSS
Back to Top