picture < /p>
Я включил все необходимые плагины: < /p>
Код: Выделить всё
< /code>
HTML -часть для таблицы довольно просто: < /p>
ID
Judet
Localitate principala
Siruta superioara
Localitati apartenente
Sirute inferioare
Tipul solicitarii
Data intrare
Ultimul status
Utilizator
Deadline
< /code>
Таблица автоматической из базы данных SQL с использованием AJAX. Я не уверен, что это имеет значение, но я помесчу это здесь. < /P>
$(document).ready(function(){
var dataTable = $('#lista_proiecte').DataTable({
"processing": true,
"serverSide": true,
"order":[],
"ajax":{
url:"php/acasa_listaproiecte_fetch.php",
type:"POST",
},
"lengthMenu": [ [10, 25, 50, -1], [10, 25, 50, "All"] ],
createdRow:function(row, data, rowIndex)
{
$.each($('td', row), function(colIndex){
if(colIndex == 1)
{
$(this).attr('data-name', 'judet');
$(this).attr('class', 'judet');
$(this).attr('data-type', 'text');
$(this).attr('data-pk', data[0]);
}
if(colIndex == 2)
{
$(this).attr('data-name', 'localitate_principala');
$(this).attr('class', 'localitate_principala');
$(this).attr('data-type', 'text');
$(this).attr('data-pk', data[0]);
}
if(colIndex == 3)
{
$(this).attr('data-name', 'siruta_superioara');
$(this).attr('class', 'siruta_superioara');
$(this).attr('data-type', 'text');
$(this).attr('data-pk', data[0]);
}
if(colIndex == 4)
{
$(this).attr('data-name', 'localitati_apartenente');
$(this).attr('class', 'localitati_apartenente');
$(this).attr('data-type', 'text');
$(this).attr('data-pk', data[0]);
}
if(colIndex == 5)
{
$(this).attr('data-name', 'sirute_inferioare');
$(this).attr('class', 'sirute_inferioare');
$(this).attr('data-type', 'text');
$(this).attr('data-pk', data[0]);
}
if(colIndex == 6)
{
$(this).attr('data-name', 'tip_solicitare');
$(this).attr('class', 'tip_solicitare');
$(this).attr('data-type', 'text');
$(this).attr('data-pk', data[0]);
}
if(colIndex == 7)
{
$(this).attr('data-name', 'data_intrare');
$(this).attr('class', 'data_intrare');
$(this).attr('data-type', 'text');
$(this).attr('data-pk', data[0]);
}
if(colIndex == 8)
{
$(this).attr('data-name', 'ultimul_status');
$(this).attr('class', 'ultimul_status');
$(this).attr('data-type', 'text');
$(this).attr('data-pk', data[0]);
}
if(colIndex == 9)
{
$(this).attr('data-name', 'nume_utilizator');
$(this).attr('class', 'nume_utilizator');
$(this).attr('data-type', 'text');
$(this).attr('data-pk', data[0]);
}
if(colIndex == 10)
{
$(this).attr('data-name', 'deadline');
$(this).attr('class', 'deadline');
$(this).attr('data-type', 'text');
$(this).attr('data-pk', data[0]);
}
});
}
});
Подробнее здесь: https://stackoverflow.com/questions/688 ... rap5-theme