CodeIgniter Forums
Not showing table properly - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Not showing table properly (/showthread.php?tid=51643)



Not showing table properly - El Forum - 05-11-2012

[eluser]xtremer360[/eluser]
I'm trying to create a page for my site with the table attached and for some reason it's not attaching the datatables to it.

My page: http://www.kansasoutlawwrestling.com/kowmanager/pmsystem/personalmessages

Template: http://kansasoutlawwrestling.com/files/templates/admin/peachv1.2/Template/tables.html

Code:

Code:
<?php echo heading('Inbox Messages', 2, 'class="grid_12"'); ?>
<div class="clear"></div>
<div class="grid_12">
    <div class="box">
        <div class="header">
            &lt;?php $image_properties= array( 'src' => 'assets/peach/img/icons/16x16/user.png', 'height' => '16px', 'width' => '16px', 'alt' => 'User' ); ?&gt;
            &lt;?php echo img($image_properties); ?&gt;
            &lt;?php echo heading('Inbox', 3); ?&gt;
            <span></span>
        </div>
        <div class="content">
            &lt;?php $this->table->set_empty('&nbsp;'); ?&gt;
            &lt;?php $tmpl = array ( 'table_open'  => '<table id="table-example" class="table">' ); ?&gt;
            &lt;?php $this->table->set_template($tmpl); ?&gt;
            &lt;?php $this->table->set_heading('', 'Subject', 'From', ''); ?&gt;
            &lt;?php echo $this->table->generate(); ?&gt;
        </div>
    </div>
</div>



Not showing table properly - El Forum - 05-11-2012

[eluser]InsiteFX[/eluser]
You need to pass your data into it.
Code:
&lt;?php echo $this->table->generate($data); ?&gt;

Besides ll table code should be in your controller except for the table_generate!



Not showing table properly - El Forum - 05-11-2012

[eluser]Samus[/eluser]
Nice site btw


Not showing table properly - El Forum - 05-11-2012

[eluser]xtremer360[/eluser]
What data are you talking about insiteFX?


Not showing table properly - El Forum - 05-11-2012

[eluser]weboap[/eluser]
can you put the <tbody> part and some data in there manually for now so we can troubleshoot the datatable issue
it's a a java issue.
then check inserting the data dynamically...


Not showing table properly - El Forum - 05-12-2012

[eluser]xtremer360[/eluser]
I updated the table and for some reason still not loading the datatables into the table.


Not showing table properly - El Forum - 05-12-2012

[eluser]xtremer360[/eluser]
Any ideas why it doesn't turn it into a datatable when it should be?


Not showing table properly - El Forum - 05-12-2012

[eluser]weboap[/eluser]
check myjs.js
Code:
$(window).load(function() {
    $('#datatable').dataTable();    
}
// you got a syntax error here


try instead

Code:
$(document).ready( function () {


  //check if the datatable table exist.

    if ($("#datatable").length > 0){
    
     //apply dataTable to #datatable table and save its object in dataTable variable
if( typeof dataTable == 'undefined' ){
     dataTable = $( '#datatable' ).dataTable();
}else{
// this two lines to help redraw the table if you add or remove lines
  dataTable.fnClearTable( 0 );
  dataTable.fnDraw();
  }

    }

  
  
  
  
  
});