0

I'm working on a project of Fees Management System for my elder brother's school project by using bootstrap 3, php, mysql.

I'm using bootstrap's plugin dataTables and unable to see the dataTables tableTools menu with dataTables. I downloaded tableTools from github and include all necessary files in dashboard page but tableTools is not working for me. Anyone can help me?

I include these files in my student-dashboard.php's head section :-

<!-- DataTables CSS --> <link href="../bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css" rel="stylesheet">   <!-- DataTables tableTools CSS --> <link rel="stylesheet" type="text/css" href="../bower_components/datatables-plugins/TableTools/css/dataTables.tableTools.css">   <!-- DataTables Responsive CSS --> <link href="../bower_components/datatables-responsive/css/dataTables.responsive.css" rel="stylesheet">   <!-- DataTables tableTools JS --> <script type="text/javascript" language="javascript" src="../bower_components/datatables-plugins/TableTools/js/dataTables.tableTools.js"></script>

And here are the codes for dataTables :

<div class="dataTable_wrapper row">
<div class="col-lg-12 table-responsive">
    <table class="table table-striped table-bordered table-hover" id="dataTables-view">
        <thead>
            <tr>
                <th>ID</th>
                <th>Roll Number</th>
                <th>Student Name</th>
                <th>Class</th>
                <th>Fee Status</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>

<?php 
$sql = mysql_query("SELECT * FROM student_info ORDER BY student_roll_number");
while($row = mysql_fetch_array($sql)){  
$id = $row["student_id"];
$rollnumber = $row["student_roll_number"];    
$fname = $row["student_fname"];
$lname = $row["student_lname"];
$class = $row["student_class"];

echo '
<tr>
<td> '.$id.'</td>
<td> '.$rollnumber.'</td>
<td> '.$fname.' '.$lname.'</td>
<td><i class="icon-group"></i> '.$class.'</td>
<td><center>Pending</center></td>
<td><center>
  <div class="btn-group text-center">

    <a href="student-view.php?id='.$id.'" class="btn btn-default btn-sm btn-default"><i class="fa fa-eye fa-1x"></i></a>
    <a href="student-modify.php?id='.$id.'" class="btn btn-default btn-sm btn-default"><i class="fa fa-edit fa-1x"></i></a>
    <a href="student-delete.php?id='.$id.'" class="btn btn-default btn-sm btn-default"><i class="fa fa-trash-o fa-1x"></i></a>

  </div></center>
</td>
</tr>
';  
}
?>                                                                       
            </tbody>
        </table>
        </div>
</div>

And in end of the page i used following codes for initializing dataTables:

 <script>
$(document).ready(function() {
$('#dataTables-view').DataTable({
        responsive: true,
        "order": [ 0, "desc" ],
        "columnDefs": [
            {
                "targets": [ 0 ],
                "visible": false,
                "searchable": false
            }
        ],
        "lengthMenu": [ [7, 20, 50, -1], [7, 20, 50, "All"] ],
        "dom": 'T<"clear">lfrtip',
        "tableTools": {
        "sSwfPath": "/swf/copy_csv_xls_pdf.swf"
        }
});
});
</script>     

The final output is this : In this picture, You can see there is no dataTables tableTools menu showing... In this picture, You can see there is no dataTables tableTools menu showing...

but i need this kind of output for my student dashboard page.

I need this kind of output for my student dashboard page

Anyone can help me to sort out this issue...?

Pawan Mall
  • 93
  • 1
  • 2
  • 10
  • 1
    `../bower_components/datatables-plugins/TableTools/js/dataTables.tableTools.js` should be included after `jquery.dataTables.js`. Most likely there is an error in the console. – Gyrocode.com Jul 30 '15 at 20:08
  • Thanks man now i can see the tableTools menu but now the buttons are not performing the task like copy, pdf or csv? – Pawan Mall Jul 30 '15 at 20:21
  • If only "Print" button is working, make sure that path to `.swf` is correct. Since it is Flash component, it also may not work locally unless you configure security permissions, see [this question](http://stackoverflow.com/questions/31197385/). – Gyrocode.com Jul 30 '15 at 20:26
  • Yes, the path to **.swf** is correct because i can see the tableTools's all buttons but the action of these button are not working except print button. – Pawan Mall Jul 30 '15 at 20:32
  • See [the link](http://stackoverflow.com/questions/31197385/) I mentioned for a possible solution. – Gyrocode.com Jul 30 '15 at 20:40
  • Thanks, but still there is only two buttons are working "Copy & Print". Other buttons are not working :( – Pawan Mall Jul 30 '15 at 20:41

1 Answers1

0

If only print and Copy button works, then there should be problem in .swf file. Make sure the path of the file is correct

After clicking the buttons (except print and copy), See whether you are getting any error in the console. If the path of the file is wrong, you will get error in the console.

Priya
  • 591
  • 1
  • 8
  • 23