Forum


21:07

31/03/2010

Hello,
i m using this so good plugins !
and i have a little problem, but i can't found how do this :
i have a php files with this XML creation files :
...
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$i = $i+1;
$tab_final = calculTPS($row['DATE_DEBUT'],$row['DATE_FIN']);
//pour le calcul du tps jour, nuit et dimanche
$piecesDebut = explodeDate( $row['DATE_DEBUT']);
$piecesFin = explodeDate($row['DATE_FIN']);
$nom_prenom = $row['NOM_EMP'].' '.$row['PRENOM_EMP'];
$s .= "<row id='". $row['NUM_MISSION']."'>";
$s .= "<cell>". $row['NOM_CLIENT']."</cell>";
$s .= "<cell>". $row['NOM_MISSION']."</cell>";
$s .= "<cell>". $piecesDebut[0]."</cell>";//date début
$s .= "<cell>". $piecesDebut[1]."</cell>";//horraire début
$s .= "<cell>". $piecesFin[0] ."</cell>";//date fin
$s .= "<cell>". $piecesFin[1]."</cell>";//horraire fin
$s .= "<cell>". $tab_final[tps_total]."</cell>"; //tps total
$s .= "<cell>". $tab_final[tps_jour]."</cell>"; //temps jour
//$total_tps_jour = $tab_final[tps_totaljour] + $total_tps_jour;
$s .= "<cell>". $tab_final[tps_nuits]."</cell>"; //temps nuit
$s .= "<cell>". $tab_final[tps_dimJour]."</cell>";//temps dimanche jour
$s .= "<cell>". $tab_final[tps_dimNuit]."</cell>";//temps dimanche nit
$s .= "<cell>". $nom_prenom."</cell>";// nbr employé sur missions
$s .= "<cell>". $row['ADRESSE_MISSION']."</cell>";
$s .= "<cell>". $row['VILLE_MISSION']."</cell>";
$s .= "<cell>". $row['CODE_POSTALE_VILLE']."</cell>";
$s .= "<cell>". $row['NUM_MISSION']."</cell>";
$s .= "</row>";
}
$s .= "<userdata>";
$s .= "<cell></cell>";
$s .= "<cell></cell>";
$s .= "<cell></cell>";/
$s .= "<cell></cell>";
$s .= "<cell> </cell>";
$s .= "<cell></cell>";
$s .= "<cell></cell>";
$s .= "<cell></cell>";
$s .= "<cell>".afficheHeure($total_tps_jour)."</cell>";
$s .= "<cell></cell>";
$s .= "<cell></cell>";
$s .= "<cell></cell>";
$s .= "<cell></cell>";
$s .= "<cell></cell>";
$s .= "<cell></cell>";
$s .= "<cell></cell>";
$s .= "</userdata>";
$s .= "</rows>";
echo $s;
and i have this for jqgrid code :
jQuery("#list").jqGrid({
edit : {
addCaption: "Add Record",
editCaption: "Edit Record",
bSubmit: "Submit",
bCancel: "Cancel",
bClose: "Close",
saveData: "Data has been changed! Save changes?",
bYes : "Yes",
bNo : "No",
bExit : "Cancel"
},
url:'modeles/tab_mission.php',
datatype: 'xml',
mtype: 'GET',
colNames:['CLIENT','MISSION','DATE_DEBUT','HEURE_DEBUT','DATE_FIN','HEURE_FIN',
'TPS_TOTAL','TPS_JOUR','TPS_NUIT','DIM_JOUR','DIM_NUIT','Nom EMPLOYE','ADR','VILLE','CODE_POSTALE_VILLE','NUM_MISSION'],
colModel :[
{name:'NOM_CLIENT',index:'NOM_CLIENT',width:70, editable: true, edittype:"select", editoptions:{dataUrl:'modules/mission/list_clients.php'}, formoptions:{ label: "Client",rowpos:1,elmprefix:" " } },
{name:'NOM_MISSION',index:'NOM_MISSION', width:90,editable:true,editoptions:{size:25}, formoptions:{ rowpos:2, label: "Nom mission", elmprefix:"(*)"},editrules:{required:true}},
{name:'DATE_DEBUT',index:'DATE_DEBUT', width:80, editable:true, editoptions:{size:12, dataInit:function(el){ $(el).datepicker({dateFormat:'yy-mm-dd'}); }, defaultValue: function(){ var currentTime = new Date(); var month = parseInt(currentTime.getMonth() + 1); month = month <= 9 ? "0"+month : month; var day = currentTime.getDate(); day = day <= 9 ? "0"+day : day; var year = currentTime.getFullYear(); return year+"-"+month + "-"+day; } }, formoptions:{ rowpos:3, elmprefix:"(*)",elmsuffix:" yyyy-mm-dd" }, editrules:{required:true} },
{name:'HEURE_DEBUT',index:'HEURE_DEBUT', width:90,editable:true,editoptions:{size:25}, formoptions:{ rowpos:4, label: "Heure debut format XX:XX", elmprefix:"(*)"},editrules:{required:true}},
{name:'DATE_FIN',index:'DATE_FIN', width:80, editable:true, editoptions:{size:12, dataInit:function(el){ $(el).datepicker({dateFormat:'yy-mm-dd'}); }, defaultValue: function(){ var currentTime = new Date(); var month = parseInt(currentTime.getMonth() + 1); month = month <= 9 ? "0"+month : month; var day = currentTime.getDate(); day = day <= 9 ? "0"+day : day; var year = currentTime.getFullYear(); return year+"-"+month + "-"+day; } }, formoptions:{ rowpos:5, elmprefix:"(*)",elmsuffix:" yyyy-mm-dd" }, editrules:{required:true} },
{name:'HEURE_FIN',index:'HEURE_FIN', width:90,editable:true,editoptions:{size:25}, formoptions:{ rowpos:6, label: "Heure fin format XX:XX", elmprefix:"(*)"},editrules:{required:true}},
{name:'TPS_TOTAL',index:'TPS_TOTAL', width:90,editable:false},
{name:'TPS_JOUR',index:'TPS_JOUR', width:90,editable:false},
{name:'TPS_NUIT',index:'TPS_NUIT', width:90,editable:false},
{name:'TPS_DIM_JOUR',index:'TPS_DIM_JOUR', width:90,editable:false},
{name:'TPS_DIM_NUIT',index:'TPS_DIM_NUIT', width:90,editable:false},
{name:'Nom_EMPLOYE',index:'Nom_EMPLOYE',width:170, editable: true, edittype:"select", editoptions:{dataUrl:'modules/mission/list_employes.php'}, formoptions:{ label: "Employe",rowpos:7,elmprefix:" " } },
{name:'ADRESSE',index:'ADRESSE_MISSION', width:90,editable:true,editoptions:{size:25}, formoptions:{ rowpos:8, label: "Adresse", elmprefix:"(*)"},editrules:{required:true}},
{name:'VILLE',index:'VILLE_MISSION', width:90,editable:true,editoptions:{size:25}, formoptions:{ rowpos:9, label: "Ville", elmprefix:"(*)"},editrules:{required:true}},
{name:'CODE_POSTALE_VILLE',index:'CODE_POSTALE_VILLE', width:90,editable:true,editoptions:{size:25}, formoptions:{ rowpos:10, label: "Code postal", elmprefix:"(*)"},editrules:{required:true}},
{name:'NUM_MISSION',index:'NUM_MISSION', width:0,editable:false},
],
pager: '#pager',
rowNum:10,
autowidth: true,
rowList:[10,20,30],
pager: jQuery('#pager'),
sortname: 'NUM_MISSION',
sortorder: 'desc',
viewrecords: true,
caption: 'Les missions',
footerrow : true,
userDataOnFooter : true,
editurl:"modules/mission/ajout_mission.php"
}).navGrid('#pager',
{view:true}
);
and wih this i can see my userdata on the summer footer of my jqgrid table, please where is the problem?
because on the demonstration have anexemple with json, but my web server don't have json function, so ican use only XML, please help, thanks.
21:47

Moderators
30/10/2007

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
22:52

31/03/2010

Hello, thanks that's better for the XML files :
$total_tps_jour=0;//total tmps jour sur la période choisi
// be sure to put text data in CDATA
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
$i = $i+1;
$tab_final = calculTPS($row['DATE_DEBUT'],$row['DATE_FIN']);
//pour le calcul du tps jour, nuit et dimanche
$piecesDebut = explodeDate( $row['DATE_DEBUT']);
....
$s .= "<cell>". $row['CODE_POSTALE_VILLE']."</cell>";
$s .= "<cell>". $row['NUM_MISSION']."</cell>";
$s .= "</row>";
}
$s .= '<userdata name ="total_tps_jour">'.$total_tps_jour.'</userdata>';
$s .= "</rows>";
echo $s;
?>
the XML files is good no error, butnow, i can see the result in the footer of the grid, i have looking this --> http://trirand.com/blog/jqgrid/jqgrid.html but i can't see where i take the information to add it on the footer of the grid.
thanks
16:15

Moderators
30/10/2007

Hello,
The name of this userdata should equal of the name from colModel.
By Example if your name is defined as
{name:'TPS_TOTAL',index:'TPS_TOTAL', width:90,editable:false},
then the appropriate data should be:
...
$s .= '<userdata name ="TPS_TOTAL">'.$total_tps_jour.'</userdata>';
Hope this helps.
Best Regards
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
74 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66