datatable is not working..searching ,pagination not working..Below is my code..Please help me.
datatable is not working..searching ,pagination not working..Below is my code..Please help me.
I am using theme.
This is my layout page.
......................................
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="<?=base_url('assets/img/basic/favicon.ico')?>" type="image/x-icon">
<title>Genie</title>
<!-- CSS -->
<link rel="stylesheet" href="<?=base_url('assets/css/app.css')?>">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
">
</body>
</html>
.................................................................................................
This is my table.
..............................................................
<section class="text-white has-overlay blue4 responsive">
<div class="container">
<div class="p-t-b-50">
<h2 class="text-center">
Customers
</h2>
</div>
</div>
</section>
<section class="white sticky shadow">
<div class="breadcrumbs p-t-b-20">
<div class="container p-t-b-5">
</div>
</div>
</section>
<div class="content-wrapper animatedParent animateOnce">
<div class="container">
<!-- /.content -->
<section class="paper-card">
<div class="row">
<div class="col-12">
<div class="box">
<div class="box-body table-responsive no-padding">
<span style="float: right;margin-bottom: 10px;"></span>
<table class="table table-hover" id="myTable">
<thead>
<tr>
<th>Sl No.</th>
<th>ID</th>
<th>Name</th>
<th>Phone</th>
<th>Email</th>
</tr>
</thead>
<?php if($customers){
$i=1;
foreach($customers as $c){
if($c->username != 'administrator'){
?>
<tbody>
<tr>
<td><?=$i++;?></td>
<td><?=$c->id?></td>
<td><a href="<?=base_url('admin/customer_details/'.$c->id)?>"><?=$c->first_name?></a></td>
<td><?=$c->phone?></td>
<td><?=$c->email?></td>
</tr>
</tbody>
<?php
}
}
}
else{
?>
<tr>
<td colspan="3">No record Found</td>
</tr>
<?php
}
?>
</table>
</div>
<!-- /.box-body -->
</div>
<!-- /.box -->
</div>
</div>
</section>
</div>
</div>
Answers
Hi @swetalina ,
We're happy to take a look. As per the forum rules, if you could link to a running test case showing the issue we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
This is my link.Please check it out.
https://jsfiddle.net/Swetalina/utpxkrez/2/
Your posted HTML makes no reference to either DataTables or jQuery javascript files.
Hi @swetalina ,
That's not loading, you haven't include the jQuery or the DataTables libraries.
Cheers,
Colin
I'm seeing this error in your browser's console:
You haven't loaded jQuery nor the Datatables CSS and JS files. I don't see where you are loading the JS files in the code above. If this a the issue you can use the Download builder to get the proper files.
Kevin
ok.Got it.
https://jsfiddle.net/Swetalina/utpxkrez/11/
This works fine here.But not working in my project.
Did you check your browser's console for errors?
Can you post a link to your page so we can help troubleshoot? Without seeing the problem its hard to help.
Kevin
This is my link.
http://demo.ratnatechnology.co.in/genie/admin/manage_customers
It prompts for a login.
Kevin
Please go through one more time..It vl not prompt for login.
Your
table
HTML is invalid. You have multipletbody
tags, one for each row. You should have only one encapsulating all the rows.Datatables only knows about the first row. At the bottom of the table you can see "Showing 1 to 1 of 1 entries".
Kevin
ok..now solved..thank you so much @kthorngren