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
| class CadastreData {
constructor({
parcelle = ""
}){
this.parcelle = parcelle
}
infoProprietaire(numero, compte){
new Proprietaire({
numero:numero,
compte:compte
}).addFiche() // qui permet d'afficher la fiche propriétaire (là dedans on ne retrouve pas que le numero, le nom et l'adresse, on retrouve aussi la liste des parcelles associées à ce propriétaire.
}
proprietaire(){
$.ajax({
url: 'fichier.php?',
type:'GET',
datatype:'json',
data:{
"parcelle":this.parcelle
},
success: (data) => {
$('#liste_proprietaires').html(`
<table class="table_dt" id="proprios">
<thead>
<tr>
<th>Id</th>
<th>Nom</th>
<th>Adresse</th>
</tr>
</thead>
</table>`);
var table = $('#proprios').DataTable({
paging: true,
autoWidth:false,
scrollCollapse: false,
fixedHeader: true,
pageLength : 10,
destroy: true,
ordering:false,
responsive:true,
language:{
"info": "_START_ de _END_ sur _TOTAL_",
"infoEmpty": "0 résultat",
"zeroRecords": "Pas de résultat"
},
dom:'Bt',
data:response,
columns: [
{data: 'dnuper', render: (data, type, row)=>{
return `<a href="#" id="${row.numero}" onclick="this.infoProprietaire('${row.compte}', '${row.numero}')">${row.numero}</a>`; // mon click inline qui permet d'accéder à la fiche propritéaire
}
},
{data: 'ddenom', render: (data, type, row)=> {
return `${row.nom_prop}`;
}
},
{data: 'adresse', render: (data, type, row)=> {
return `${row.adresse ? row.adresse : 'nc'}`;
}
}
]
});
}
}
})
} |
Partager