1
I need to list all id decreasingly on my jQuery datatable.
Which is the best way to it?
<script type="text/javascript">
window.properties = <?= json_encode($ci_properties) ?>;
$(document).ready( function () {
$('#na_datatable').DataTable();
$('body').on('click','.btn.view',function(e){
var id = $(e.target).closest('.btn.view').data("id");
var property = window.properties.find(p => p.propertie_id == id);
$('#view-property .modal-body').html('');
$('#view-property .modal-title .propertie-id').html(property.propertie_id);
$('#view-property .modal-body').append(`<div><b>Bairro:</b> ${property.bairro}</div>`);
$('#view-property .modal-body').append(`<div><b>Empreendimento:</b> ${property.empreendimento}</div>`);
$('#view-property .modal-body').append(`<div><b>Apartamento:</b> ${property.apartamento}</div>`);
$('#view-property .modal-body').append(`<div><b>Dormtirórios:</b> ${property.dormitorios}</div>`);
$('#view-property .modal-body').append(`<div><b>Box:</b> ${property.box}</div>`);
$('#view-property .modal-body').append(`<div><b>Mobiliado:</b> ${property.mobiliado}</div>`);
$('#view-property .modal-body').append(`<div><b>Chaves:</b> ${property.chaves}</div>`);
$('#view-property .modal-body').append(`<div><b>Proprietario:</b> ${property.proprietario}</div>`);
$('#view-property .modal-body').append(`<div><b>Contato:</b> ${property.contato}</div>`);
$('#view-property .modal-body').append(`<div><b>Valor:</b> ${property.valor}</div>`);
$('#view-property .modal-body').append(`<div><b>Cadastro:</b> ${property.cadastro}</div>`);
$('#view-property .modal-body').append(`<div><b>Atualizado:</b> ${property.atualizado}</div>`);
});
} );
Currently it is like this:
But I always need to list the last record that was registered by first: