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
   |  
function Tri(P_Fichier) {
 
	WFichier = G_RepXML + "UtilisateursVista.xml";
	$(document).ready( function(){
		$.ajax( {
			type: "GET",
			url: WFichier,
			async: false, // Empêche la poursuite du code tant que la fonction n'est pas terminée.
			dataType: "xml",
			error: function (jqXHR, textStatus, errorThrown) 
			{
				alert("Problème avec le fichier XML, veuillez vérifier le fichier '" + WFichier + "'." + G_CrLf + "Traitement impossible.");
//				window.close();
				window.location.reload();
			},
			success: function(xml) 
			{
				$( function(){
					function su(a,b){
						var compA = $(a).find('EMAIL').text().toLowerCase();
						var compB = $(b).find('EMAIL').text().toLowerCase();
						return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
					}
 
					$xml=$('<XML/>').html(stringxml);
					$utilisateurs= $xml.find('UTILISATEUR');
					$utilisateurs.sort(su);
					$xml.append($utilisateurs);
 
					$xml.find('UTILISATEUR').each( function(){
						// INSERER L'ECRITURE DU FICHIER ICI ?
						console.log ( $(this).find('NOM').text() );
					})
				})
			} // FIN SUCCES
		});
	});
} | 
Partager