-
-
Save tigrang/e6b9d53a407280f791f3abceea285394 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>Column Filter</h2> | |
<?php $this->start('tfoot'); ?> | |
<tr> | |
<th><input type="text" placeholder="Search id"/></th> | |
<th><input type="text" placeholder="Search username"/></th> | |
<th><input type="text" placeholder="Search created at"/></th> | |
<th><input type="text" placeholder="Search updated at"/></th> | |
<th></th> | |
</tr> | |
<?php $this->end(); ?> | |
<?php | |
echo $this->DataTable->render('User', [ | |
'id' => 'UsersTable', | |
'tfoot' => $this->fetch('tfoot'), | |
]); | |
?> | |
<?php $this->Html->scriptStart(['block' => 'table_extras']); ?> | |
$(document).ready(function() { | |
var table = $('#UsersTable'); | |
var oTable = table.dataTable(); | |
$("#UsersTable tfoot input").keyup(function () { | |
/* Filter on the column (the index) of this element */ | |
oTable.fnFilter(this.value, $("tfoot input").index(this)); | |
}); | |
}); | |
<?php $this->Html->scriptEnd(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment