Welcome Guest, Not a member yet? Register   Sign In
Datatables and Join Statement
#1

[eluser]Hayezb[/eluser]
Hello!

I'm using Datatables and Bootstrap with CodeIgnier ( it's freaking amazing all together! ) but have encountered a problem. I've setup over 10 tables in my application so far, but I'm trying to create a new one and need to join 2 tables together. But I can't figure out how!


My Functions:
Code:
public function tableload_sent(){
  
  $this->load->database();
  $this->load->library('Datatables');
  $this->datatables->select('ID, MANUFACTURERID, ORDERDATE');
  $this->datatables->from('INVENTORY_ORDERS');
  $this->datatables->where('STATUS = 1');
  $this->datatables->add_column('edit', '<a href="view_inventory_order/order_info/$1">view</a>', 'ID');
  
  echo $this->datatables->generate();
  
}

My View:
Code:
[removed]
        $(document).ready(function() {
            $('#ordersent').dataTable( {
          "sPaginationType": "bs_normal",
                   "bProcessing": true,
                  "bServerSide": true,
                  "sAjaxSource": "&lt;?php echo base_url('inventory_orders/tableload_sent')?&gt;",
                   "sServerMethod": "POST",
                   "aoColumnDefs": { "bVisible": false, "aTargets": [0]}
              } );
          } );
       [removed]
          
       <table cellpadding="0" cellspacing="0" border="0" class="datatable table table-striped table-bordered" id="ordersent">
        <thead>
            <tr>
                <th>Order Number</th>
                   <th>Manufacturer</th>
                   <th>Order Date</th>
                   <th></th>
               </tr>
           </thead>
           <tbody>
               <tr>
                <td colspan="6" class="dataTables_empty">Loading data from server</td>
             </tr>
         </tbody>
       </table>

I'm not wanting the ManufacturerId to show, I'm wanting to join with the Manufacturer table and display the actual Manufacturer Name from that table.

Any help would be greatly appreciated!! Thank you!!




Theme © iAndrew 2016 - Forum software by © MyBB