Bonjour,
J'ai un soucis dans un développement basé sur un datable. Le but est simple, j'ai une liste de fournisseurs et si je clique sur un fournisseur, je veux connaître la liste de ses contacts...
Mon script php renvoie un json qui va bien. Maintenant, je voudrais intégrer dans le .php un paramètre pID qui recevrait, au moment de l'appel Ajax, le numéro du fournisseur...Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 initListeContacts: function(idFournisseur){ tableContacts = $('#tableContacts').dataTable({ "aLengthMenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "Tous"] // change per page values here ], "bProcessing": true, "bRetrieve": true, "bDestroy": true, "bServerSide": true, "sAjaxSource": "listeContacts.php", "iDisplayLength": 100, "sPaginationType": "bootstrap_full_number", "oLanguage": { "sProcessing": '<i class="fa fa-coffee"></i> Veuillez patienter...', "sLengthMenu": "_MENU_ enregistrement(s)", "oPaginate": { "sPrevious": "Prec.", "sNext": "Suiv." } }, "fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) { )}; }
J'ai essayé de rajouter ça :Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 initListeContacts: function(idFournisseur){ tableContacts = $('#tableContacts').dataTable({ "aLengthMenu": [ [10, 25, 50, 100, -1], [10, 25, 50, 100, "Tous"] // change per page values here ], "bProcessing": true, "bRetrieve": true, "bDestroy": true, "bServerSide": true, "sAjaxSource": "listeContacts.php", "iDisplayLength": 100, "sPaginationType": "bootstrap_full_number", "oLanguage": { "sProcessing": '<i class="fa fa-coffee"></i> Veuillez patienter...', "sLengthMenu": "_MENU_ enregistrement(s)", "oPaginate": { "sPrevious": "Prec.", "sNext": "Suiv." } }, "fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) { )}; }
et de récupérer le contenu dans le .phpCode:
1
2
3
4 "fnServerData": function (sSource, aoData, fnCallback) { aoData.push({ "name": "pId", "value": idFournisseur }); },
Avez-vous un peu d'aide à me fournir ?Code:
1
2 $id = $_POST['pId']; // j'ai essayé aussi avec $_GET
Merci,
Vincent
