mirror of
https://github.com/brmlab/brmsklad.git
synced 2025-08-02 06:13:35 +02:00
Search on columns on Items
This commit is contained in:
parent
b60a06e76b
commit
856717989a
2 changed files with 72 additions and 33 deletions
|
@ -22,7 +22,7 @@
|
|||
<thead>
|
||||
<?php foreach ($scaffoldFields as $_field): ?>
|
||||
<?php if($_field == "id") continue; ?>
|
||||
<th><?php echo $_field; ?></th>
|
||||
<th><?php echo $_field; ?><br/><input class="search_init" type="text" name="<?php echo $_field; ?>" /></th>
|
||||
<?php endforeach; ?>
|
||||
<th><?php echo __d('cake', 'Actions'); ?></th>
|
||||
</thead>
|
||||
|
@ -61,6 +61,13 @@ foreach (${$pluralVar} as ${$singularVar}):
|
|||
endforeach;
|
||||
|
||||
?>
|
||||
<tfoot>
|
||||
<?php foreach ($scaffoldFields as $_field): ?>
|
||||
<?php if($_field == "id") continue; ?>
|
||||
<th><?php echo $_field; ?></th>
|
||||
<?php endforeach; ?>
|
||||
<th><?php echo __d('cake', 'Actions'); ?></th>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<div class="actions">
|
||||
|
|
|
@ -15,8 +15,40 @@
|
|||
echo $this->fetch('script');
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
var asInitVals = new Array();
|
||||
$(document).ready(function(){
|
||||
$('#datatables').dataTable({iDisplayLength:50});
|
||||
var oTable = $('#datatables').dataTable({iDisplayLength:50});
|
||||
$("thead input").keyup( function () {
|
||||
/* Filter on the column (the index) of this element */
|
||||
oTable.fnFilter( this.value, $("thead input").index(this) );
|
||||
} );
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Support functions to provide a little bit of 'user friendlyness' to the textboxes in
|
||||
* the footer
|
||||
*/
|
||||
$("thead input").each( function (i) {
|
||||
asInitVals[i] = this.value;
|
||||
} );
|
||||
|
||||
$("thead input").focus( function () {
|
||||
if ( this.className == "search_init" )
|
||||
{
|
||||
this.className = "";
|
||||
this.value = "";
|
||||
}
|
||||
} );
|
||||
|
||||
$("thead input").blur( function (i) {
|
||||
if ( this.value == "" )
|
||||
{
|
||||
this.className = "search_init";
|
||||
this.value = asInitVals[$("thead input").index(this)];
|
||||
}
|
||||
} );
|
||||
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue