Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter + Datatables JS
#2

[eluser]benton.snyder[/eluser]
Controller:

Code:
public function get_tickets()
{
  $this->load->model('tickets');
  echo json_encode($this->tickets->listTickets(NULL, TRUE));  
}

View:

Code:
[removed][removed]
<link href="<?=$this->config->base_url();?>includes/datatables/css/jquery.dataTables.css" type="text/css" rel="stylesheet" />

[removed]

$(document).ready(function() {

// initialize tickets datatable
oTable = $('#tickets').dataTable( {
  "sScrollX": "100%",
  "sScrollXInner": "100%",
  "bProcessing": true,
  "bServerSide": true,
  "bJQueryUI": true,
  "sAjaxSource": '<?=$this->config->site_url();?>/main/get_tickets'
} );
[removed]
<div id="datatables">
  <table id="tickets">
      <thead>
          <tr>
              <th>ID</th>
              <th>Last Update</th>
              <th>Created</th>
              <th>Priority</th>
              <th>Subject</th>
              <th>Description</th>
              <th>Flagged</th>
              <th>Owner</th>
              <th>Group</th>
          </tr>
      </thead>
      <tbody>
          <tr>
              <td>Row 1 Data 1</td>
              <td>Row 1 Data 2</td>
              <td>Row 1 Data 3</td>
              <td>Row 1 Data 4</td>
              <td>Row 1 Data 5</td>
              <td>Row 1 Data 6</td>
              <td>Row 1 Data 7</td>
              <td>Row 1 Data 8</td>
              <td>Row 1 Data 9</td>
          </tr>
      </tbody>
  </table>
</div>


Messages In This Thread
CodeIgniter + Datatables JS - by El Forum - 10-18-2012, 08:52 PM
CodeIgniter + Datatables JS - by El Forum - 10-18-2012, 09:33 PM
CodeIgniter + Datatables JS - by El Forum - 10-18-2012, 09:42 PM
CodeIgniter + Datatables JS - by El Forum - 10-18-2012, 09:46 PM
CodeIgniter + Datatables JS - by El Forum - 10-19-2012, 01:25 AM
CodeIgniter + Datatables JS - by El Forum - 11-11-2012, 11:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB