Skip to content

Instantly share code, notes, and snippets.

@tigrang
Forked from destinydriven/gist:9d8e4cba4fc03df79962
Last active August 29, 2015 14:20
Show Gist options
  • Save tigrang/29b4b7b670ae47eace57 to your computer and use it in GitHub Desktop.
Save tigrang/29b4b7b670ae47eace57 to your computer and use it in GitHub Desktop.
<?php
public $components = array(
'Paginator',
'RequestHandler',
'DataTable.DataTable' => array(
'Employee' => array(
'columns' => array(
'id' => false, // bSearchable and bSortable will be false
'last_name' => array(
'label' => 'Last Name',
'bSearchable' => true,
'bSortable' => true
) , // bSearchable and bSortable will be true, with a custom label `Name`
'first_name' => array(
'label' => 'First Name',
'bSearchable' => true,
'bSortable' => true,
) ,
'nic_number' => array(
'label' => 'NIC #',
'bSearchable' => true,
'bSortable' => true
) ,
'tax_number' => array(
'label' => 'Tax Number',
'bSearchable' => true,
'bSortable' => true
) ,
'tax_code' => array(
'label' => 'Tax Code',
'bSearchable' => true,
'bSortable' => true
) ,
'active' => array(
'label' => 'Active',
'bSortable' => true
) ,
'department' => array(
'useField' => false
) , //array('label' => 'Department', 'bSearchable' => true, 'bSortable' => true),//
'Actions' => array(
'useField' => false
) // tells DataTable that this column is not tied to a field
) ,
'contain' => array(
'EmploymentData' => array(
'fields' => array(
'department_id'
) ,
'Department' => array(
'fields' => 'name'
)
)
) ,
'recursive' => - 1,
'joins' => array(
array(
'table' => 'employment_data',
'alias' => 'EmploymentDatum',
'type' => 'LEFT',
'conditions' => array(
'EmploymentDatum.employee_id = Employee.id'
)
) ,
array(
'table' => 'departments',
'alias' => 'Department',
'type' => 'LEFT',
'conditions' => array(
'Department.id = EmploymentData.department_id'
)
)
)
) ,
'Department' => array(
'columns' => array(
'name' => array(
'label' => 'Name',
'bSearchable' => true,
'bSortable' => true
) , // bSearchable and bSortable will be true, with a custom label `Name`
)
)
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment