Items show all, datatables, sorting, filtering

This commit is contained in:
Marek Sebera 2013-01-23 00:41:35 +01:00
parent 07fbba7428
commit 786acdd599
15 changed files with 450 additions and 28 deletions

View file

@ -18,14 +18,14 @@
?>
<div class="<?php echo $pluralVar; ?> index">
<h2><?php echo $pluralHumanName; ?></h2>
<table cellpadding="0" cellspacing="0">
<tr>
<table cellpadding="0" cellspacing="0" id="datatables">
<thead>
<?php foreach ($scaffoldFields as $_field): ?>
<?php if($_field == "id") continue; ?>
<th><?php echo $this->Paginator->sort($_field); ?></th>
<th><?php echo $_field; ?></th>
<?php endforeach; ?>
<th><?php echo __d('cake', 'Actions'); ?></th>
</tr>
</thead>
<?php
foreach (${$pluralVar} as ${$singularVar}):
echo '<tr>';
@ -62,18 +62,6 @@ endforeach;
?>
</table>
<p><?php
echo $this->Paginator->counter(array(
'format' => __d('cake', 'Page {:page} of {:pages}, showing {:current} records out of {:count} total, starting on record {:start}, ending on {:end}')
));
?></p>
<div class="paging">
<?php
echo $this->Paginator->prev('< ' . __d('cake', 'previous'), array(), null, array('class' => 'prev disabled'));
echo $this->Paginator->numbers(array('separator' => ''));
echo $this->Paginator->next(__d('cake', 'next') .' >', array(), null, array('class' => 'next disabled'));
?>
</div>
</div>
<div class="actions">
<h3><?php echo __d('cake', 'Actions'); ?></h3>

View file

@ -9,11 +9,16 @@
<?php
echo $this->Html->meta('icon');
echo $this->Html->css('cake.generic');
echo $this->Html->script(array('jquery.min','jquery.dataTables.min'));
echo $this->fetch('meta');
echo $this->fetch('css');
echo $this->fetch('script');
?>
<script type="text/javascript">
$(document).ready(function(){
$('#datatables').dataTable({iDisplayLength:50});
});
</script>
</head>
<body>
<div id="container">