-
Notifications
You must be signed in to change notification settings - Fork 334
Function Reference
Note: If you are using PHP 5 you can use method chaining for more compact syntax. This is described here: Method Chaining
Click here for more info: http://codeigniter.com/user_guide/database/active_record.html
Sets which columns to fetch from the specified table.
$this->datatables->select('id, name, age, gender');
*This function also accepts an optional second parameter. Click here for more info: http://codeigniter.com/user_guide/database/active_record.html
Sets the primary table in which data will be fetched from.
$this->datatables->from('mytable');
Sets join statement variables. If you want DataTables to include data from another table, you can define an a table along with its columns and foreign key relationship.
$this->datatables->join('mystates', 'mycountries.state_id = mystates.id', 'left');
*This function also accepts an optional third parameter for specifying the join type.
Sets filtering variable to facilitate custom filters. For additional filtering conditions, the WHERE clause works like CodeIgniter's. So you can do statements like:
$this->datatables->where('id', '5');
$this->datatables->where('age >', '25');
$this->datatables->where('position != "admin"');
$array = array('name' => 'J%', 'status' => 'Single');
$this->datatables->where($array);
Sets filtering variable to facilitate custom filters. Adds "(filtered from xxx total entries)" to datatables. Same usage with 'where()' method.
Sets additional column variables to facilitate custom columns. You can also make your own custom column definitions via the following syntax: *match_replacement is optional only needed if you have $1 to $n matches in your content pattern
$this->datatables->add_column('edit', '<a href="profiles/edit/$1">EDIT</a>', 'id');
Sets additional column variables for editing columns. You can also make your own custom column definitions via the following syntax: *match_replacement is needed in order to replace $1 to $n matches in your content pattern
$this->datatables->edit_column('username', '<a href="profiles/edit/$1">$2</a>', 'id, username');
Builds all the necessary query segments and performs the main query based on results set from chained statements. *charset is optional if you wish to generate results using a different character set other than UTF-8 (default)
$this->datatables->generate();
$this->datatables->generate('ISO-8859-1');