How to using CRUD in DataTables
- Single Page
Posted 31 January 2013 - 13:53 PM
[color=#111111][font='Lucida Grande', Verdana, Arial, Helvetica, sans-serif][size=3][left][background=rgb(246, 246, 255)]How to create a CRUD (Create Read Update Delete) in a data table, I find it difficult to make it[/background][/left][/size][/font][/color]
[color=#111111][font='Lucida Grande', Verdana, Arial, Helvetica, sans-serif][size=3][left][background=rgb(246, 246, 255)]Thankyou.. [/background][/left][/size][/font][/color]
Posted 31 January 2013 - 15:18 PM
Posted 31 January 2013 - 15:23 PM
public function getdatabase()
{
$crud = new grocery_CRUD();
$crud->set_table('tb_lirik');
$crud->columns('id_lirik','nama_band','judul','status','full_lirik');
$output = $crud->render();
$this->_example_output($output);
}
but no change in the appearance of my web
Posted 31 January 2013 - 15:29 PM
Posted 31 January 2013 - 15:33 PM
$crud = new grocery_CRUD();
$crud->set_table('tb_lirik');
$crud-> set_theme('datatables');
$crud->columns
('id_lirik','nama_band','judul','status','full_lirik');
$output = $crud->render();
$this->_example_output($output);
Posted 31 January 2013 - 15:45 PM
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Site extends CI_Controller {
//function __construct(){
// parent::__construct();
//kalo harus login, remarknya dibuka dulu
// $this->sudahlogin();
// }
public function index()
{
$this->load->view('post');
}
public function getdatabase()
{
$crud = new grocery_CRUD();
$crud->set_table('tb_lirik');
$crud-> set_theme(datatables');
$crud->columns
('id_lirik','nama_band','judul','status','full_lirik'); --------> This line 20
$output = $crud->render();
$this->_example_output($output);
}
public function getdatabyajax()
{
$this->load->library('datatables');
$this->datatables
->select('id_lirik,nama_band,judul,status,full_lirik')
->from('tb_lirik');
echo ($this->datatables->generate());
//echo ($this->datatables->fnFormatDetails());
}
// function sudahlogin(){
// $sudah = $this->session->userdata('sudahlogin');
// if (!isset($sudah) || $sudah != true) {
// redirect('login');
//echo 'sorry bro';
//die();
// }
// }
//
// function logout(){
// $this->session->unset_userdata('sudahlogin',false);
// }
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
Posted 31 January 2013 - 15:46 PM
Posted 31 January 2013 - 15:51 PM
you forgot to type quote after "(".
your version is $crud-> set_theme(datatables');
Posted 31 January 2013 - 16:05 PM
i want to be like this
Posted 31 January 2013 - 16:06 PM
Posted 31 January 2013 - 16:11 PM
Posted 31 January 2013 - 16:17 PM
[attachment=454:Untitled.jpg]
i want to be like this
[attachment=455:Untitled2.jpg]
Posted 31 January 2013 - 16:26 PM
Posted 31 January 2013 - 16:40 PM
Posted 31 January 2013 - 17:36 PM
Posted 31 January 2013 - 18:16 PM
Posted 31 January 2013 - 18:35 PM
Posted 31 January 2013 - 19:18 PM
Posted 01 February 2013 - 01:42 AM
In groceryCRUD, datatable is just a name of a theme. Another possible theme is "flexigrid". I think you've mix them up.
You don't need any datatable library since this function of yours already produce a fully working CRUD:
public function getdatabase()
{
$crud = new grocery_CRUD();
$crud->set_table('tb_lirik');
$crud-> set_theme('datatables');
$crud->columns
('id_lirik','nama_band','judul','status','full_lirik');
$output = $crud->render();
$this->_example_output($output);
}
The problem lied on the last line:
$this->_example_output($output)
You've call the "_example_output" function, but you don't have such a function in that corresponding controller.
Good luck