I have a paginated table (15 records per page) with 3 buttons to show me the active, inactive or all records. The issue is that if I give the assets for example and on the first page there are only 4 active records, it only shows those 4 and not those on the next page. If I pass the page, the filter is reset and it shows me again.
<script type="text/javascript">
$(document).ready(function(){
$(".btn-group .btn").click(function(){
var inputValue = $(this).find("input").val();
if(inputValue != 'all'){
var target = $('table tr[data-status="' + inputValue + '"]');
$("table tbody tr").not(target).hide();
target.fadeIn();
} else {
$("table tbody tr").fadeIn();
}
});
});
</script>
<div class="table-responsive">
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-light active">
<input type="radio" name="status" class="btn btn-light" value="active" checked="checked"><i class="zmdi zmdi-power" style="color:#0F0"></i> Active
</label>
<label class="btn btn-light">
<input type="radio" name="status" class="btn btn-light" value="inactive"><i class="zmdi zmdi-circle-o" style="color:#F00"></i> Inactive
</label>
<label class="btn btn-light">
<input type="radio" name="status" class="btn btn-light" value="all"><i class="zmdi zmdi-apps"></i> All
</label>
</div>
<table id="data-table" class="table">
<thead>
<tr>
<th>Name</th>
<th>Year</th>
<th>SAT?</th>
<th>QH?</th>
<th>Status</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$query = mysql_query("select * from student LEFT JOIN
school_year ON student.school_year_id = school_year.school_year_id
ORDER BY student.firstname ASC") or die(mysql_error());
while ($row = mysql_fetch_array($query)) {
$id = $row['student_id'];
$student_stat = $row['status'];
$student_sat = $row['lessons_id'];
$student_qh = $row['qh_id'];
if ($row['status'] == 'Unregistered' ){ $estado = "inactive"; }
else if ($row['status'] == 'Registered' ){ $estado = "active"; }
?>
<tr data-status="<?php echo $estado; ?>">
<td><a href="view_student.php<?php echo '?id='.$id; ?>"><?php echo $row['firstname'] . " " . $row['lastname']; ?></a>
<br>
<small class="text-muted">User: <?php echo $row['username']; ?></small>
<br>
<small class="text-muted">Pass:<?php echo $row['password']; ?></small>
</td>
<td><?php echo $row['school_year']; ?></td>
<?php if ($row['lessons_id'] == '2' ){ ?>
<td><a href="de_activate_sat.php<?php echo '?id='.$id; ?>" class="btn btn-outline-danger">No</a></td>
<?php }else if ($row['lessons_id'] == '1'){ ?>
<td><a href="activate_sat.php<?php echo '?id='.$id; ?>" class="btn btn-outline-success">Yes</a></td>
<?php } ?>
<?php if ($row['qh_id'] == '2' ){ ?>
<td><a href="de_activate_qh.php<?php echo '?id='.$id; ?>" class="btn btn-outline-danger">No</a></td>
<?php }else if ($row['qh_id'] == '1'){ ?>
<td><a href="activate_qh.php<?php echo '?id='.$id; ?>" class="btn btn-outline-success">Yes</a></td>
<?php } ?>
<?php if ($row['status'] == 'Unregistered' ){ ?>
<td><a href="de_activate_student.php<?php echo '?id='.$id; ?>" class="btn btn-outline-danger"><i class="icon-remove"></i> Inactive</a></td>
<?php }else if ($row['status'] == 'Registered'){ ?>
<td><a href="activate_student.php<?php echo '?id='.$id; ?>" class="btn btn-outline-success"><i class="icon-check"></i> Active</a></td>
<?php } ?>
<td>
<div class="btn-group" role="group">
<button type="button" class="btn btn-light dropdown-toggle" data-toggle="dropdown">
Options
</button>
<div class="dropdown-menu">
<a href="view_student.php<?php echo '?id='.$id; ?>" class="dropdown-item">Profile</a>
<a href="exams.php<?php echo '?id='.$id; ?>" class="dropdown-item">Exams</a>
<a href="colleges.php<?php echo '?id='.$id; ?>" class="dropdown-item">Applications</a>
<a href="payments.php<?php echo '?id='.$id; ?>" class="dropdown-item">Payments</a>
<?php $my_pro4 = mysql_query("SELECT * FROM message where reciever_id = '$id' and message_status = 'unread'")or die(mysql_error());
$count_my_pro4 = mysql_num_rows($my_pro4);?>
<?php if ($count_my_pro4 != 0 ){ ?>
<a href="reports.php<?php echo '?id='.$id; ?>" class="dropdown-item"><?php echo $count_my_pro4;?> <i class="zmdi zmdi-email"></i></a>
<?php } ?>
<a data-toggle="modal" data-id="<?php echo $id;?>" data-target="#modal-default" class="dropdown-item" style="color:#F00">Remove</a> </div>
</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>