Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 不分页的表行筛选器_Javascript_Php_Jquery_Filter_Tablefilter - Fatal编程技术网

Javascript 不分页的表行筛选器

Javascript 不分页的表行筛选器,javascript,php,jquery,filter,tablefilter,Javascript,Php,Jquery,Filter,Tablefilter,我想筛选表数据,但我有100多行,所以我使用了分页。如果我应用任何过滤器,它只会过滤entier表中插入的当前页面 下面给出了Html和javascript代码 <select id='filterText' style='display:inline-block' onchange='filterText()'> <option disabled selected>Select</option> <option value='Active'>Ac

我想筛选表数据,但我有100多行,所以我使用了分页。如果我应用任何过滤器,它只会过滤entier表中插入的当前页面

下面给出了Html和javascript代码

<select id='filterText' style='display:inline-block' onchange='filterText()'>
<option disabled selected>Select</option>
<option value='Active'>Active</option>
<option value='Obsolete'>Obsolete</option>
<option value='all'>All</option>
</select>


<table class="table table-striped table-bordered table-hover  table-list-search" id="dataTables-example"  >
<thead>
<tr style="background-color:#abdcd5;">
    <th align="left" class="col-xs-2">Employee ID</th>
    <th align="left" class="col-xs-1">Name</th>
    <th align="left" class="col-xs-2">Location</th>
    <th align="left" class="col-xs-2">Company </th>
    <th align="left" class="col-xs-3">Job Description</th>
    <th align="left" class="col-xs-1">Status</th>
    <th align="left" class="col-xs-1">Action</th>
</tr>
</thead>
<tbody>

    <?php employeedetails::employeelist();?>

</tbody>
                </table>

挑选
活跃的
过时的
全部的
员工ID
名称
位置
单位
职位描述
地位
行动
Javascript

<script>
function filterText() {  
    var rex = new RegExp($('#filterText').val());
    if(rex == "/all/") {
        clearFilter();
    } else {
        $('.content').hide();
        $('.content').filter(function() {
            return rex.test($(this).text());
        }).show();
    }
}

function clearFilter() {
    $('.filterText').val('');
    $('.content').show();
}
</script>

函数filterText(){
var rex=new RegExp($('#filterText').val();
如果(rex==“/all/”){
clearFilter();
}否则{
$('.content').hide();
$('.content').filter(函数(){
返回rex.test($(this.text());
}).show();
}
}
函数clearFilter(){
$('.filterText').val('');
$('.content').show();
}
Php代码

  <?php

  class employeedetails
  {

    //function for display details of employee

 static function employeelist()
{
    $tenanPortalId = $_SESSION['PortalID'];
    $databaseConnectionObject = new DB_CONNECT();

   $resultForGettingDetailsOfEmployees  =   mysqli_query($databaseConnectionObject->connect(),$Query); 

if(!$resultForGettingDetailsOfEmployees){

    die(mysqli_error($databaseConnectionObject->connect()));
}

else if($resultForGettingDetailsOfEmployees)
{


    while($row = mysqli_fetch_array($resultForGettingDetailsOfEmployees))
    {


        $employee_ID=$row['employee_id'];
        $employee_ID_trim = str_replace($tenanPortalId."~","",$row['employee_id']);
        $employee_Name=$row['employee_name'];
        $employee_Location=$row['employee_location'];
        $employee_Status=$row['employee_Status'];
        $expenseManager=$row['expenseManager'];
        $SnactionManager=$row['SnactionManager'];
        $EmployeeLocation=$row['countryName'];
        $hireDate=$row['hireDate'];

        if($row['company'] == "->")
        {
            $company = "";
        }
        else
        {
            $company=$row['company'];
        }

        if($row['reportingLineUnit'] == "->")
        {
            $reportingLineUnit="";
        }
        else
        {
            $reportingLineUnit=$row['reportingLineUnit'];
        }

        $employeeType = $row['employeeType'];
        $jobdescription = $row['jobDescription'];

        ?>
        <tr class="content">
            <td>

                <a data-toggle="modal" data-target='#<?php echo "$employee_ID_trim"; ?>' style="cursor: pointer;"> 
                    <?php echo "$employee_ID";?>
                </a>

                <?php

                    $msg = "";
                    if($SnactionManager == "" || $SnactionManager == "No") 
                    { 
                      $msg = "Do you want to make $employee_Name as Sanction Manager?" ;                            
                    }
                    else
                    {
                      $msg = "Do you want to remove $employee_Name as Sanction Manager?" ;
                      //echo " <span><img src='../assets/img/twouser.png' width='20px;' height='20px;'/></span>";
                    }

                    echo $imgPath = ($expenseManager == "Yes") ? 
                                (($SnactionManager == "Yes") ? " <span><img src='../assets/img/twouser.png' width='20px;' height='20px;' title='Project & Sanction Manager'/></span>" : " <span><img src='../assets/img/project.png' width='20px;' height='20px;' title='Project Manager'/></span>" ) 
                                : 
                                (($SnactionManager == "Yes") ? " <span><img src='../assets/img/sanction.png' width='20px;' height='20px;' title='Sanction Manager'/></span>" : "" ) ;
                ?>


                <!-- Modal -->
                    <div id='<?php echo "$employee_ID_trim"; ?>' class="modal fade" role="dialog"  ">
                      <div class="modal-dialog">

                        <!-- Modal content-->
                        <div class="modal-content">
                          <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal">&times;</button>
                            <h4 class="modal-title">
                                <?php echo "$employee_Name";?>
                            </h4>
                          </div>
                          <div class="modal-body">
                            <div class="table-responsive">
                              <table class="table table-bordered table-hover">
                                <tr style="background-color:#abdcd5;">
                                    <th align="left" class="col-xs-2">Project Manager</th>
                                    <th align="left" class="col-xs-2">Sanction Manager</th>
                                    <th align="left" class="col-xs-2">Type</th>     
                                    <th align="left" class="col-xs-2">Reporting Line Unit </th> 
                                    <th align="left" class="col-xs-2">Hire Date </th> 

                                </tr>
                                <tr>
                                    <td><?php echo "$expenseManager";?></td>

                                    <td><?php echo "$SnactionManager";?></td>

                                    <td><?php echo "$employeeType";?></td>

                                    <td><?php echo "$reportingLineUnit";?></td>

                                    <td><?php echo date("m/d/Y", strtotime($hireDate));?></td>

                                </tr>

                              </table>
                            </div>
                          </div>
                          <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                          </div>
                        </div>

                      </div>
                    </div>

            </td>
            <td>
                <?php echo "$employee_Name"; ?>

            </td>
            <td><?php echo "$EmployeeLocation";?></td>


            <td><?php echo "$company";?></td>

            <td><?php echo "$jobdescription";?></td>



            <?php $color =($employee_Status=="Obsolete" ? "red" : "green") ; ?>




<td style="color:<?php echo $color; ?> ;font-weight:bold;text-align:center;"><?php echo "$employee_Status";?></td>

            <td align="center">


                <button type="button" style="background-color:#00a4a4;border-color:#00a4a4;" class="btn btn-primary btn-xs" data-toggle="modal" data-target='#<?php echo "$employee_ID_trim"."SMM"; ?>' style="cursor: pointer;">
                    <span  class="glyphicon glyphicon-pencil"></span>
                </button>



                <div id='<?php echo "$employee_ID_trim"."SMM"; ?>' class="modal fade" role="dialog"  ">
                  <div class="modal-dialog">

                    <!-- Modal content-->
                    <div class="modal-content">
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h4 class="modal-title">
                            <?php echo "$employee_Name";?>
                        </h4>
                      </div>
                      <div class="modal-body">
                        <div class="row" style="padding-bottom:5%;">
                            <?php echo $msg; ?>
                        </div>
                        <div class="row" style="padding-bottom:3%;">

                            <form id="eventForm"  action="../index.php" method ="POST"> 

        <input type="hidden" class="form-control" id=""  name="EmployeeId" value="<?php echo "$employee_ID"; ?>" />
    <input type="hidden" class="form-control" id=""  name="EmployeeName" value="<?php echo "$employee_Name"; ?>" />
                                <?php 
                    $buttonName = "Assign";
                if($SnactionManager == "" || $SnactionManager == "No") 
                    { 
                ?>
            <input type="hidden" name="SnManager"  value="Yes">                     
                <?php
                }
                else
                { 
                    $buttonName = "Remove";
                ?>
            <input type="hidden" name="SnManager"  value="No">
            <?php   
                }
            ?>          

        <button type="submit" class="btn btn-primary" value="Assign Manger" name="operation"> 
        <span class="glyphicon glyphicon-ok" ></span>
                    <?php echo $buttonName; ?> 
        </button>

        <button type="button" class="btn btn-danger" data-dismiss="modal">
            <span class="glyphicon glyphicon-remove" ></span>
            Cancel
            </button>

        </form> 


</div>
</div>

</div>
</div>
</div>  
</td>
</tr>


<?php   
} //while

} //else if

} //function
} //class
?>

;字体大小:粗体;文本对齐:居中;">
" />

你能重新表述前两个句子吗?这真的很难理解。@SMugunthankumar你能发布你的表格代码吗?当然我会发布代码。你能重新表述前两个句子吗?这真的很难理解。@SMugunthankumar你能发布你的表格代码吗?当然我会发布代码