Bonjour alors voilà j'utilise un dataTable pour afficher des operations comptables, le chargement se fait en Ajax avec le code suivant :

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
$(document).ready(function() {
	table = $('#grandLivre').dataTable({
		"pagingType": "simple",
		"dom": 'rt<"pagination align-center row-fluid"p>',
		"oLanguage": {
			"sLengthMenu": '<s:text name="dataTables.sLengthMenu"/>',
			"sZeroRecords": '<s:text name="dataTables.sZeroRecords"/>',
			"sInfo": '<s:text name="dataTables.sInfo"/>',
			"sInfoEmpty": '<s:text name="dataTables.sInfoEmpty"/>',
			"sEmptyTable": '<s:text name="dataTables.sEmptyTable"/>',
			"sInfoFiltered":'<s:text name="dataTables.sInfoFiltered"/>',
			"sSearch": '<s:text name="dataTables.sSearch"/>',
		     "oPaginate": {
		        "sNext": '<s:text name="dataTables.sNext"/>',
		        "sPrevious": '<s:text name="dataTables.sPrevious"/>',
		      }
		},
		"processing": true,
        "serverSide": true,
        "ajax": {
            "url": "ChangerPeriode.action",
            "type": "POST",
           	"data": function (d) {
                d.mois = $("#mois > option:selected").val();
                d.annee = $("#annee > option:selected").val();
        	},
        },
        "columns": [
            { "data": "date" },
            { "data": "compteVirtuel.intitule" },
            { "data": "intitule" },
            { "data": "montant" },
            { "data": "montant" },
        ]
	});
 
});
Comme vous le constatez, j'ai deux listes déroulantes pour choisir le mois et l'année et le rechargement est automatique.
Cependant j'ai un soucis, c'est que les opérations sont soit un débit soit un crédit et j'ai deux colonne pour ça une débit une crédit et j'aimerais en fonction de ce que me retourne je json affiché le montant du débit ou du crédit dans la bonne la colonne

Voilà mon code html pour être plus claire :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
<table id="grandLivre" class="table table-index">
							<thead>
								<tr>
									<th><s:text name="compta.resume.table.date"/></th>
									<th><s:text name="compta.resume.table.compte"/></th>
									<th><s:text name="compta.resume.table.intitule"/></th>
									<th><s:text name="compta.resume.table.debit"/></th>
									<th><s:text name="compta.resume.table.credit"/></th>
								</tr>
							</thead>
							<tbody>
</tbody>
</table>
il faudrait un if sur mon json mais je vois pas comment faire si quelqu'un a une idée