IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

jQuery Discussion :

Tri avec dataTables


Sujet :

jQuery

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Février 2006
    Messages
    165
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2006
    Messages : 165
    Par défaut Tri avec dataTables
    Bonjour,

    J'utilise jquery et dataTables.
    J'emploie dataTables avec server_processing, scroller...
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    <link type="text/css" rel="stylesheet" href="js/dt/jquery.dataTables.css">
    <link type="text/css" rel="stylesheet" href="js/dt/jquery.dataTables-my.css">
    <link type="text/css" rel="stylesheet" href="js/dt/jquery.dataTables.scroller.css">
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/dt/jquery.dataTables.js"></script>
    <script type="text/javascript" src="js/dt/jquery.dataTables.scroller.js"></script>
    <script type="text/javascript" src="js/dt/jquery.dataTables.FixedHeader.js"></script>
    <script type="text/javascript" src="js/dt/jquery.dataTables.columnFilter.js"></script>

    Voici ma page html, ici

    Et j'ai un problème de tri.
    Pouvez-vous prendre un peu de votre temps pour m'aider ?
    Je n'arrive pas à trier sur une colonne extra calculée (rapport Lg/lg)
    Pour y accéder, cliquer sur "'critères avancés" et cochez "Rapport Lg/lg"...
    Tentez de classer en cliquant sur l'entête relative à cette colonne...
    Le tri ne s'effectue pas ! De plus, le slider-control (relatif au rapport Lg/lg) ne fonctionne pas non plus !
    J'ai aussi le même problème de tri pour la colonne "délai"...
    Ces 2 colonnes sont des extra colonnes, d'ailleurs !!!
    Pourquoi ces 3 bugs en même temps ???

    D'avance, un immense merci pour votre aide !!!

    Voici mes scripts dataTables :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    jQuery.fn.dataTableExt.oSort['numeric-comma-asc']  = function(a,b) {
    	var x = (a == "-") ? 0 : a.replace( /,/, "." );
    	var y = (b == "-") ? 0 : b.replace( /,/, "." );
    	x = parseFloat( x );
    	y = parseFloat( y );
    	return ((x < y) ? -1 : ((x > y) ?  1 : 0));
    };
     
    jQuery.fn.dataTableExt.oSort['numeric-comma-desc'] = function(a,b) {
    	var x = (a == "-") ? 0 : a.replace( /,/, "." );
    	var y = (b == "-") ? 0 : b.replace( /,/, "." );
    	x = parseFloat( x );
    	y = parseFloat( y );
    	return ((x < y) ?  1 : ((x > y) ? -1 : 0));
    };
    et encore :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    $(document).ready(function() {
    	url();
    	$('#example').dataTable( {
    		"bDestroy": true,
    		"sScrollY": example,			
    //		"bPaginate": false,
    		"bFilter": false,
    		"bInfo": false,
    		"bScrollCollapse": true,
    		"BJQueryUI" : true,
    		"aoColumns": [
    			{ "sTitle": "C","bSortable": true,"sClass": "alignCenter","bVisible": true},
    			{ "sTitle": "forme","bSortable": true,	"sClass": "alignLeft",    	"bVisible": true},
    			{ "sTitle": "carat","bSortable": true,	"sClass": "alignRight","bVisible": true},
    			{ "sTitle": "taille",	"bSortable": true,	"sClass": "alignCenter", "bVisible": true},
    			{ "sTitle": "couleur","bSortable": true,"sClass": "alignCenter", "bVisible": true},
    			{ "sTitle": "pureté","bSortable": true,"sClass": "alignCenter",	"bVisible": true},
    			{ "sTitle": "poli","bSortable": true,"sClass": "alignCenter","bVisible":	(swColonne[11]==1)?true:false},
    			{ "sTitle": "sym","bSortable": true,"sClass": "alignCenter","bVisible":	(swColonne[12]==1)?true:false},
    			{ "sTitle": "prof","bSortable": true,"sClass": "alignRight","bVisible":(swColonne[13]==1)?true:false},
    			{ "sTitle": "table",	"bSortable": true,"sClass": "alignRight","bVisible":(swColonne[14]==1)?true:false},
    			{ "sTitle": "fluo","bSortable": true,"sClass": "alignCenter", 	"bVisible":(swColonne[15]==1)?true:false},
    			{ "sTitle": "prix/ct","bSortable": true,"sClass": "alignRight","bVisible":(swColonne[16]==1)?true:false},
    			{ "sTitle": "colette","bSortable": true,"sClass": "alignCenter","bVisible":(swColonne[17]==1)?true:false},
    			{ "sTitle": "Lg/lg",	"bSortable": true,	"sType": "numeric-comma",type: "number","sClass": "alignRight","bVisible":	(swColonne[18]==1)?true:false},
    			{ "sTitle": "délai","bSortable": true,"sClass": "alignRight","bVisible": true},
    			{ "sTitle": "prix","bSortable": true,"sClass": "alignRight","bVisible": true},
    			{ "sTitle": "détail","bSortable": false,"sClass": "alignCenter","bVisible": true}
    		],
    		"sAjaxSource": "js/dt/chargementdata33.php" + argurl,
    		"bDeferRender": true,
    		"bServerSide": true,
    		"sDom": "frtiS",
    		"oScroller": {
    			"loadingIndicator": true
    		},
    		"oLanguage": {
    			"sLoadingRecords": "Chargement en cours...",
    			"sZeroRecords": "Aucun diamant n'a pu être trouvé !"
    		},
    		"sScrollX": "100%",
    		"sScrollXInner": coef,
    		"fnServerData": function ( sSource, aoData, fnCallback ) {
    			aoData.push( { "name": "more_data", "value": "my_value" } );
    			$.getJSON( sSource, aoData, function (json) {
    				maxref = json.iTotalRecords;
    				triref = json.iTotalDisplayRecords;
    				nbreference();
    				fnCallback(json)
    			} );
           	},
    	} );
    } );
    Voici url() :
    (aStart_101 et aEnd_101 : sont les limites du slider control pour le "rapport Lg/lg")
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    function url() {
    	argurl = "";
    	if (formes != "") {
    		argurl += "&sSearch_1="  + formes;
    	}
    	if (selectionMIN[1] != plageMIN[1] || selectionMAX[1] != plageMAX[1]) {
    		argurl += "&sStart_2=" + selectionMIN[1] + "&sEnd_2=" + selectionMAX[1];
    	}
    	if (selectionMIN[2] != plageMIN[2] || selectionMAX[2] != plageMAX[2]) {
    		argurl += "&sSearch_4=";
    		for (ind=selectionMIN[2]; ind<=selectionMAX[2]; ind++) {
    			argurl += ind + " ";
    		}
    		argurl = argurl.substr(0,(argurl.length-1));
    	}
    	if (selectionMIN[3] != plageMIN[3] || selectionMAX[3] != plageMAX[3]) {
    		argurl += "&sStart_15=" + selectionMIN[3] + "&sEnd_15=" + selectionMAX[3];
    	}
    	if (selectionMIN[4] != plageMIN[4] || selectionMAX[4] != plageMAX[4]) {
    		argurl += "&sSearch_3=";
    		for (ind=selectionMIN[4]; ind<=selectionMAX[4]; ind++) {
    			argurl += ind + " ";
    		}
    		argurl = argurl.substr(0,(argurl.length-1));
    	}
    	if (selectionMIN[5] != plageMIN[5] || selectionMAX[5] != plageMAX[5]) {
    		argurl += "&sSearch_5=";
    		for (ind=selectionMIN[5]; ind<=selectionMAX[5]; ind++) {
    			argurl += ind + " ";
    		}
    		argurl = argurl.substr(0,(argurl.length-1));
    	}
    	if (selectionMIN[11] != plageMIN[11] || selectionMAX[11] != plageMAX[11]) {
    		argurl += "&sSearch_6=";
    		for (ind=selectionMIN[11]; ind<=selectionMAX[11]; ind++) {
    			argurl += ind + " ";
    		}
    		argurl = argurl.substr(0,(argurl.length-1));
    	}
    	if (selectionMIN[12] != plageMIN[12] || selectionMAX[12] != plageMAX[12]) {
    		argurl += "&sSearch_7=";
    		for (ind=selectionMIN[12]; ind<=selectionMAX[12]; ind++) {
    			argurl += ind + " ";
    		}
    		argurl = argurl.substr(0,(argurl.length-1));
    	}
    	if (selectionMIN[13] != plageMIN[13] || selectionMAX[13] != plageMAX[13]) {
    		argurl += "&sStart_8=" + selectionMIN[13] + "&sEnd_8=" + selectionMAX[13];
    	}
    	if (selectionMIN[14] != plageMIN[14] || selectionMAX[14] != plageMAX[14]) {
    		argurl += "&sStart_9=" + selectionMIN[14] + "&sEnd_9=" + selectionMAX[14];
    	}
    	if (selectionMIN[15] != plageMIN[15] || selectionMAX[15] != plageMAX[15]) {
    		argurl += "&sSearch_10=";
    		for (ind=selectionMIN[15]; ind<=selectionMAX[15]; ind++) {
    			argurl += ind + " ";
    		}
    		argurl = argurl.substr(0,(argurl.length-1));
    	}
    	if (selectionMIN[16] != plageMIN[16] || selectionMAX[16] != plageMAX[16]) {
    		argurl += "&sStart_11=" + selectionMIN[16] + "&sEnd_11=" + selectionMAX[16];
    	}
    	if (selectionMIN[17] != plageMIN[17] || selectionMAX[17] != plageMAX[17]) {
    		argurl += "&sSearch_12=";
    		for (ind=selectionMIN[17]; ind<=selectionMAX[17]; ind++) {
    			argurl += ind + " ";
    		}
    		argurl = argurl.substr(0,(argurl.length-1));
    	}
    	if (selectionMIN[18] != plageMIN[18] || selectionMAX[18] != plageMAX[18]) {
    		argurl += "&sStart_101=" + selectionMIN[18] + "&sEnd_101=" + selectionMAX[18];
    	}
    	if (argurl != "") {
    		argurl = argurl.replace('&','?');
    	}
    	return argurl;
    }
    Voici maintenant "changementdata33.php" (le server_processing) :
    (rapport Lg/lg => variable $rll)
    Code php : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     <?php
    	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    	 * libellés types
    	 * 0 = forme
    	 * 3 = taille
    	 * 4 = couleur
    	 * 5 = pureté
    	 * 6 = poli
    	 * 7 = symetrie
    	 * 10 = fluo
    	 */
    	$libelle = array();
    	$libelle[1] = array ("", "Rond", "Princesse", "Emeraude", "Radiant", "Ovale", "Poire", "Marquise", "Coeur", "Asscher CS");
    	$libelle[4] = array ("D", "E", "F", "G", "H", "I", "J", "K");
    	$libelle[3] = array ("Faible", "Bon", "Tr&egrave;s bon", "Excellent", "Id&eacute;al");
    	$libelle[5] = array ("IF", "VVS1", "VVS2", "VS1", "VS2", "SI1", "SI2", "SI3", "I1");
    	$libelle[6] = array ("Faible", "Bon", "Tr&egrave;s bon", "Excellent");
    	$libelle[7] = array ("Faible", "Bon", "Tr&egrave;s bon", "Excellent");
    	$libelle[10] = array ("Sans", "Tr&egrave;s l&eacute;g&egrave;re", "L&eacute;g&egrave;re", "Faible", "Moyenne", "Forte", "Tr&egrave;s forte");
    	$libelle[12]  = array ("Pointue", "Tr&egrave;s petite", "Petite", "Moyenne", "Large");
    	$nbcouleur = count($libelle[4])-1;
    	$nbtaille = count($libelle[3])-1;
    	$nbpurete = count($libelle[5])-1;
    	$nbpoli = count($libelle[6])-1;
    	$nbsymetrie = count($libelle[7])-1;
    	$nbfluo = count($libelle[10])-1;
    	$nbcolette = count($libelle[12])-1;
    	$nbTrouve=0;
     
    	$swColonne = array();
    	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
    	 * Easy set variables
    	 */
     
    	/* Array of database columns which should be read and sent back to DataTables. Use a space where
    	 * you want to insert a non-database field (for example a counter or static image)
    	 */
    	$aColumns = array();
    	$aColumns [] = 'item_id';				/* 00					*/
    	$aColumns [] = 'cut';					/* 01					*/
    	$aColumns [] = 'carat';					/* 02					*/
    	$aColumns [] = 'cut_grade';				/* 03					*/
    	$aColumns [] = 'color';					/* 04					*/
    	$aColumns [] = 'clarity';				/* 05					*/
    	$aColumns [] = 'polish';				/* 06	option11		*/
    	$aColumns [] = 'symmetry';				/* 07	option12		*/
    	$aColumns [] = 'depth';					/* 08	option13		*/
    	$aColumns [] = 'table'; 				/* 09	option14		*/
    	$aColumns [] = 'fluo_intensity';		/* 10	option15		*/
    	$aColumns [] = 'price_per_carat';		/* 11	option16		*/
    	$aColumns [] = 'culet_size';			/* 12	option17		*/
    	$aColumns [] = 'item_id';				/* 13	option18		*/
    	$aColumns [] = 'item_id';				/* 14					*/
    	$aColumns [] = 'total_price';			/* 15					*/
    	$aColumns [] = 'item_id';				/* 16					*/
     
    	/* Indexed column (used for fast and accurate table cardinality) */
    	$sIndexColumn = "item_id";
     
    	/* DB table to use */
    	$sTable = "diamant_data";
     
    	/* Database connection information */
    	$gaSql['user']       = "celinni";
    	$gaSql['password']   = "gvL4e@gd";
    	$gaSql['db']         = "celinni";
    	$gaSql['server']     = "localhost";
     
     
    	/* 
    	 * MySQL connection
    	 */
    	$gaSql['link'] =  mysql_pconnect( $gaSql['server'], $gaSql['user'], $gaSql['password']  ) or
    		die( 'Could not open connection to server' );
     
    	mysql_select_db( $gaSql['db'], $gaSql['link'] ) or 
    		die( 'Could not select database '. $gaSql['db'] );
     
    	mysql_set_charset( 'utf8' ); 	
     
     
    	/* 
    	 * Paging
    	 */
    	$sLimit = "";
    	if ( isset( $_GET['iDisplayStart'] ) && $_GET['iDisplayLength'] != '-1' )
    	{
    		$sLimit = "LIMIT ".intval( $_GET['iDisplayStart'] ).", ".
    			intval( $_GET['iDisplayLength'] );
    	}
     
     
    	/*
    	 * Ordering
    	 */
    	$sOrder = "";
    	if ( isset( $_GET['iSortCol_0'] ) )
    	{
    		$sOrder = "ORDER BY  ";
    		for ( $i=0 ; $i<intval( $_GET['iSortingCols'] ) ; $i++ )
    		{
    			if ( $_GET[ 'bSortable_'.intval($_GET['iSortCol_'.$i]) ] == "true" )
    			{
    				$sOrder .= "`".$aColumns[ intval( $_GET['iSortCol_'.$i] ) ]."` ".
    					($_GET['sSortDir_'.$i]==='asc' ? 'asc' : 'desc') .", ";
    			}
    		}
     
    		$sOrder = substr_replace( $sOrder, "", -2 );
    		if ( $sOrder == "ORDER BY" )
    		{
    			$sOrder = "";
    		}
    	}
     
     
    	/* 
    	 * Filtering
    	 * NOTE this does not match the built-in DataTables filtering which does it
    	 * word by word on any field. It's possible to do here, but concerned about efficiency
    	 * on very large tables, and MySQL's regex functionality is very limited
    	 */
    	$sWhere = "";
    	if ( $_GET['sSearch'] != "" )
    	{
    		$sWhere = "(";
    		$aWords = preg_split('/\s+/', $_GET['sSearch']);
    		for ( $j=0 ; $j<count($aWords) ; $j++ )
    		{
    			if ( $aWords[$j] != "" )
    			{
    				$sWhere .= "(";
    				for ( $i=0 ; $i<count($aColumns) ; $i++ )
    				{
    					$sWhere .= "`".$aColumns[$i]."` LIKE '%".mysql_real_escape_string( $aWords[$j] )."%' OR ";
    				}
    				$sWhere = substr_replace( $sWhere, "", -3 );
    				$sWhere .= ") AND ";
    			}
    		}
     
    		$sWhere = substr_replace( $sWhere, "", -5 );
    		$sWhere .= ")";
    	}
     
    	/* Individual column filtering */
    	$sColumnWhere = "";
    	for ( $i=0 ; $i<count($aColumns) ; $i++ )
    	{	
    		if ( $_GET['sSearch_'.$i] != "" )
    		{
    			$aWords = preg_split('/\s+/', $_GET['sSearch_'.$i]);
    			$sColumnWhere .= "(";
    			for ( $j=0 ; $j<count($aWords) ; $j++ )
    			{
    				if ( $aWords[$j] != "" )
    				{
    					$sColumnWhere .= "`".$aColumns[$i]."` = '".mysql_real_escape_string( $libelle[ $i ][ $aWords[$j] ] )."' OR ";
    				}
    			}
    			$sColumnWhere = substr_replace( $sColumnWhere, "", -3 );
    			$sColumnWhere .= ") AND ";
    		}
    		if ( $_GET['sStart_'.$i] != "" AND $_GET['sEnd_'.$i] != "" )
    		{
    			$sColumnWhere .= "(";
    			$sColumnWhere .= "`".$aColumns[$i]."` >= '".mysql_real_escape_string( $_GET['sStart_'.$i] )."' AND `".$aColumns[$i]."` <= '".mysql_real_escape_string( $_GET['sEnd_'.$i] )."' ";
    			$sColumnWhere .= ") AND ";
    		}
    	}
     
    	if ( $sColumnWhere != "" ) {
    		$sColumnWhere = substr_replace( $sColumnWhere, "", -5 );
    		if ( $sWhere == "" ) {
    			$sWhere = $sColumnWhere;
    		} else {
    			$sWhere .= " AND ".$sColumnWhere;
    		}
    	}
     
    	if ( $sWhere != "" )
    	{
    		$sWhere = "WHERE ".$sWhere;
    	}
     
     
    	/*
    	 * SQL queries
    	 * Get data to display
    	 */
    	$sQuery = "
    	 SELECT SQL_CALC_FOUND_ROWS `dimensions`, `country`, `state`, `".str_replace(" , ", " ", implode("`, `", $aColumns))."` 
    		FROM   $sTable
    		$sWhere
    		$sOrder
    		$sLimit
    		";
    	$rResult = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
     
    	/* Data set length after filtering */
    	$sQuery = "
    		SELECT FOUND_ROWS()
    	";
    	$rResultFilterTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
    	$aResultFilterTotal = mysql_fetch_array($rResultFilterTotal);
    	$iFilteredTotal = $aResultFilterTotal[0];
     
    	/* Total data set length */
    	$sQuery = "
    		SELECT COUNT(`".$sIndexColumn."`)
    		FROM   $sTable
    	";
    	$rResultTotal = mysql_query( $sQuery, $gaSql['link'] ) or die(mysql_error());
    	$aResultTotal = mysql_fetch_array($rResultTotal);
    	$iTotal = $aResultTotal[0];
     
     
    	/*
    	 * Output
    	 */
    	$output = array(
    		"sEcho" => intval($_GET['sEcho']),
    		"iTotalRecords" => $iTotal,
    		"iTotalDisplayRecords" => $iFilteredTotal,
    		"aaData" => array()
    	);
     
    	while ( $aRow = mysql_fetch_array( $rResult ) )
    	{
    				unset ($mesures);
    				$row = array();
    				$comparer = trim($aRow[ 'item_id' ]);
    				$row[] = "<div id='tag".$comparer."'><input type='checkbox' name='comparer".$comparer."' id='comparer".$comparer."' class='curseur' value='0' onclick='acomparer(".$comparer.");'></div> ";
    				$row[] = trim($aRow[ 'cut' ]);
    				$inter = trim($aRow[ 'carat' ]);
    				$row[] = number_format($inter, 2, ',', ' ');
    				$row[] = trim($aRow[ 'cut_grade' ]);
    				$row[] = trim($aRow[ 'color' ]);
    				$row[] = trim($aRow[ 'clarity' ]);
    				$row[] = trim($aRow[ 'polish' ]);
    				$row[] = trim($aRow[ 'symmetry' ]);
    				$inter = trim($aRow[ 'depth' ]);
    				$row[] = number_format($inter, 2, ',', ' ');
    				$inter = trim($aRow[ 'table' ]);
    				$row[] = number_format($inter, 2, ',', ' ');
    				$row[] = trim($aRow[ 'fluo_intensity' ]);
    				$inter = trim($aRow[ 'price_per_carat' ]);
    				$row[] = number_format($inter, 0, ',', ' ');
    				$row[] = trim($aRow[ 'culet_size' ]);
    				$dimensions = trim($aRow[ 'dimensions' ]);
    				$mesures = explode("x",$dimensions);
    				$mesures[0] = floatval($mesures[0]);
    				$mesures[1] = floatval($mesures[1]);
    				$mesures[2] = floatval($mesures[2]);
    				if ($mesures[0] == 0 OR $mesures[1] == 0) {
    					$rll = 0;
    				} else {
    					if ($mesures[0] >= $mesures[1]) {
    						$rll = $mesures[0] / $mesures[1];
    					} else {
    						$rll = $mesures[1] / $mesures[0];
    					}
    				}
    				$row[] = number_format($rll, 2, ',', ' ');
    				$country = strtolower(trim($aRow[ 'country' ]));
    				$delai = "";
    				switch ($country) {
    					case "france":
    						$delai = "1 jour";
    						break;
    					case "belgium":
    					case "united kingdom":
    						$delai = "2 jours";
    						break;
    					case "india":
    					case "israel":
    					case "usa":
    					case "united arab emirates":
    					case "south africa":
    						$delai = "9 jours";
    						break;
    					default:
    						$state = strtolower(trim($aRow[ 'state' ]));
    						switch ($state) {
    							case "hong kong":
    								$delai = "5 jours";
    								break;
    							default:
    								$delai = "15 jours";
    								break;
    						}
    						break;
    				}
    				$row[] = $country;
    				$inter = trim($aRow[ 'total_price' ]);
    				$row[] = number_format($inter, 2, ',', ' ');
    				$row[] = "<a href='index.php?id=".trim($aRow[ 'item_id' ])."'><div class='voir'>Détails</div></a>";
    				if ( $_GET['sStart_101'] != "" AND $_GET['sEnd_101'] != "" ) {
    					if ($rll >= $_GET['sStart_101'] AND $rll <= $_GET['sEnd_101'])
    					{
    						$output['aaData'][] = $row;
    						$nbTrouve++;
    					}
    				} else {
    					$output['aaData'][] = $row;
    				}
    	}
    	if ( $_GET['sStart_101'] != "" AND $_GET['sEnd_101'] != "" ) {
    		$output["iTotalDisplayRecords"] = $nbTrouve;
    	}
     
    	echo json_encode( $output );
    ?>

  2. #2
    Membre confirmé
    Profil pro
    Inscrit en
    Février 2006
    Messages
    165
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2006
    Messages : 165
    Par défaut
    Je viens de modifier de façon significative,
    ma source de la page.
    Voici la nouvelle version ici

    Hélàs, l'erreur est toujours là.
    Pouvez-vous m'aider ?
    Merci d'avance.

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Février 2006
    Messages
    165
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Février 2006
    Messages : 165
    Par défaut
    Après des tests sur firebug, mon server_processing (chargementdata33.php") est OK !
    Pas d'erreur !
    Le problème de tri est bien dans la page principale ("recherche33.php") !

    Seulement, il y a un problème avec le jquery de "datatables" !

    Pouvez-vous m'aider ? Je n'en peux plus !
    A l'aide !

Discussions similaires

  1. Réponses: 5
    Dernier message: 05/11/2007, 23h30
  2. formule de calcul du TRI avec PL/SQL
    Par mongilotti dans le forum Algorithmes et structures de données
    Réponses: 15
    Dernier message: 30/07/2005, 20h23
  3. Pb de tri avec champs vide
    Par Invité dans le forum Langage SQL
    Réponses: 2
    Dernier message: 01/06/2004, 17h42
  4. tri avec l'ordre UPDATE et incrementation d'une colonne
    Par Staron dans le forum Langage SQL
    Réponses: 3
    Dernier message: 17/02/2004, 08h48
  5. tri avec les champs vides en dernier
    Par r-zo dans le forum Requêtes
    Réponses: 11
    Dernier message: 03/09/2003, 13h40

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo