append row to table
$.each(table.rows, function(index, val) {
row = newTableRow(val);
});
$("#tblAgendados").append(row);
/* ======================================================================== */
/* newTableRow */
/* ======================================================================== */
function newTableRow(cols) {
res = "<tr>";
$.each(cols, function(index, val) {
res += '<td>' + val + '<td>';
});
res += "</tr>";
return res;
};
<?php
echo "<script>";
echo 'var table = {' .
' rows : []'.
' };';
echo "var i = 0;";
echo "row = {};";
foreach ($this->paginator as $table):
foreach($table as $key => $value) {
echo 'row.' . $key . " = " . "'$value'" . ';';
}
echo "table.rows.push(row);";
endforeach;
echo "</script>";
?>
<?php if(sizeof($this->paginator)): ?>
<div class="responsive">
<table class="table table-striped" id="tblAgendados">
<thead>
<tr>
<th>Nome</th>
<th>Tel</th>
<th>Ativo</th>
<th>e-mail</th>
</tr>
</thead>
<tbody></tbody>
</table>
</div>
<?php else: ?>
Nenhum item encontrado.
<?php endif; ?>
<div class="pagination-control">
<?= $this->paginator; ?>
</div>