add filter field, placeholder in input filter field

This commit is contained in:
Uwe Steinmann 2019-11-26 17:49:27 +01:00
parent a75d337912
commit d82b59f173
2 changed files with 16 additions and 2 deletions

View File

@ -56,7 +56,7 @@ class SeedDMS_View_SubstituteUser extends SeedDMS_Bootstrap_Style {
$this->contentHeading(getMLText("substitute_user")); $this->contentHeading(getMLText("substitute_user"));
?> ?>
<input type="text" id="myInput"> <input type="text" id="myInput" placeholder="<?= getMLText('type_to_filter'); ?>">
<table id="myTable" class="table table-condensed"> <table id="myTable" class="table table-condensed">
<thead> <thead>
<tr><th><?php printMLText('name'); ?></th><th><?php printMLText('email');?></th><th><?php printMLText('role'); ?></th><th><?php printMLText('groups'); ?></th><th></th></tr> <tr><th><?php printMLText('name'); ?></th><th><?php printMLText('email');?></th><th><?php printMLText('role'); ?></th><th><?php printMLText('groups'); ?></th><th></th></tr>

View File

@ -31,6 +31,19 @@ require_once("class.Bootstrap.php");
*/ */
class SeedDMS_View_UserList extends SeedDMS_Bootstrap_Style { class SeedDMS_View_UserList extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
?>
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myTable tbody tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
<?php
} /* }}} */
function show() { /* {{{ */ function show() { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
@ -49,7 +62,8 @@ class SeedDMS_View_UserList extends SeedDMS_Bootstrap_Style {
$sessionmgr = new SeedDMS_SessionMgr($dms->getDB()); $sessionmgr = new SeedDMS_SessionMgr($dms->getDB());
?> ?>
<table class="table table-condensed"> <input type="text" id="myInput" placeholder="<?= getMLText('type_to_filter'); ?>">
<table id="myTable" class="table table-condensed">
<thead><tr><th></th><th><?php printMLText('name'); ?></th><th><?php printMLText('groups'); ?></th><th><?php printMLText('role'); ?></th><th><?php printMLText('discspace'); ?></th><th><?php printMLText('authentication'); ?></th><th></th></tr></thead><tbody> <thead><tr><th></th><th><?php printMLText('name'); ?></th><th><?php printMLText('groups'); ?></th><th><?php printMLText('role'); ?></th><th><?php printMLText('discspace'); ?></th><th><?php printMLText('authentication'); ?></th><th></th></tr></thead><tbody>
<?php <?php
foreach ($allUsers as $currUser) { foreach ($allUsers as $currUser) {