I am not very familiar with javascript and I am also pretty new here. I am getting an error on the console that says Uncaught TypeError: undefined is not a function.
I am trying to sort a table and create a pagination in php. There's no fatal error but it won't work. I don't know why. Here's my code:
header.php
<!-- Mobile viewport optimisation -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Add meta data here -->
<link id="bootstrapFlexible" href="styles/flexible-columns.css" rel="stylesheet" type="text/css"/>
<link id="bootstraptheme" rel="stylesheet" type="text/css" href="css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="css/jquery.css" />
<script src="js/jquery-1.9.1.js"></script>
<script src="js/jquery-ui.js"></script>
<script src="js/jquery.tablesorter.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("table").tablesorter({
sortList: [[2,0]],
// pass the headers argument and assing a object
headers: {
// assign the secound column (we start counting zero)
5: {
// disable it by setting the property sorter to false
sorter: false
}
}
});
});
</script>
<meta charset="utf-8"/>
<script>
function settheme() {
if (localStorage.getItem("settheme") === null) {
}else{
var theme = localStorage['settheme'];
document.getElementById('bootstraptheme').href = theme;
}
};
window.onload = settheme;
</script>
This is my table:
$query = $dbh -> query("SELECT COUNT(*) FROM reminders r
JOIN reminder_type rt
ON r.type_of_reminder = rt.reminder_type_id
JOIN subjects s
ON r.subject = s.subject_id");
$num_rows=$query->rowCount();
$rows = $query->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT);
$pages = new Paginator;
$pages->items_total = $rows[0];
$pages->mid_range = 5; // Number of pages to display. Must be odd and > 3
$pages->paginate();
echo $pages->display_pages();
echo "<span class=\"\">".$pages->display_jump_menu().$pages->display_items_per_page()."</span>";
echo "<form method='POST'>
<input type='text' name='search_key'/>
<input type='submit' name='search_button' value='S E A R C H'/>
</form>";
echo '<table style="width:100%;margin:auto; text-align: center;" id="bord" class="tablesorter">';
echo '<thead id="table_head">
<tr style="height:50px;font-size:18px;font-weight:bold; background:#00a651; color:#fff;"">';
echo " <th class='thh'>Name</th>
<th class='thh'>Subject</th>
<th class='thh'>Reminder Type</th>
<th class='thh'>Description</th>
<th class='thh'>Date of Deadline</th>
<th class='thh'>Time of Deadline</th>
<th>Option</th>
</tr></thead>
<tbody>";
And this is the paginator class that I got from the web.
I appreciate all your suggestions guys. I already looked up on SO but I can't seem to find the solution. So, thank you, guys!