Hi Amit,
The Examples.php controller:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Examples extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->database();
$this->load->helper('url');
$this->load->library('grocery_CRUD');
}
public function _example_output($output = null)
{
$this->load->view('example.php',(array)$output);
}
public function offices()
{
$output = $this->grocery_crud->render();
$this->_example_output($output);
}
public function index()
{
$this->_example_output((object)array('output' => '' , 'js_files' => array() , 'css_files' => array()));
}
function tor()
{
$crud = new grocery_CRUD();
$crud =>set_theme('datatables');
$crud->set_table('tor');
$crud->columns('SerialNumber','Manager','Technician Name', 'Email', 'Phone', 'Tech Id', 'Date Issued', 'Date Audited', 'Date Returned');
$crud->field_type('SerialNumber', 'readonly');
$output = $crud->render();
$this->_example_output($output);
}
}
The view example.php
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php
foreach($css_files as $file): ?>
<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
<?php endforeach; ?>
<?php foreach($js_files as $file): ?>
<script src="<?php echo $file; ?>"></script>
<?php endforeach; ?>
</head>
<body>
<div>
<a href='<?php echo site_url('examples/tor')?>'>>TOR</a>
</div>
<div style='height:20px;'></div>
<div>
<?php echo $output; ?>
</div>
</body>
</html>
The edit view from datatables theme folder:
<div style='height:20px;'></div>
<div>
<div class='ui-widget-content ui-corner-all datatables'>
<h3 class="ui-accordion-header ui-helper-reset ui-state-default form-title">
<div class='floatL form-title-left'>
<a href="#">Edit Record
</a>
</div>
<div class='clear'></div>
</h3>
<div class='form-content form-div'>
<form action="http://localhost/examples/tor/update/1" method="post" id="crudForm" enctype="multipart/form-data" accept-charset="utf-8">
<div>
<div class='form-field-box odd' id="SerialNumber_field_box">
<div class='form-display-as-box' id="SerialNumber_display_as_box">
SerialNumber :
</div>
<div class='form-input-box' id="SerialNumber_input_box">
<div id="field-SerialNumber" class="readonly_label">Y001
</div> </div>
<div class='clear'></div>
</div>
<div class='form-field-box even' id="Manager_field_box">
<div class='form-display-as-box' id="Manager_display_as_box">
Manager :
</div>
<div class='form-input-box' id="Manager_input_box">
<input id='field-Manager' class='form-control' name='Manager' type='text' value="david smilth" maxlength='30' /> </div>
<div class='clear'></div>
</div>
<div class='form-field-box odd' id="Technician Name_field_box">
<div class='form-display-as-box' id="Technician Name_display_as_box">
Technician Name :
</div>
<div class='form-input-box' id="Technician Name_input_box">
<input id='field-Technician Name' class='form-control' name='Technician Name' type='text' value="david smith" maxlength='20' /> </div>
<div class='clear'></div>
</div>
<div class='form-field-box even' id="Email_field_box">
<div class='form-display-as-box' id="Email_display_as_box">
Email :
</div>
<div class='form-input-box' id="Email_input_box">
<input id='field-Email' class='form-control' name='Email' type='text' value="david.smith@email.com" maxlength='30' /> </div>
<div class='clear'></div>
</div>
<div class='form-field-box odd' id="Phone_field_box">
<div class='form-display-as-box' id="Phone_display_as_box">
Phone :
</div>
<div class='form-input-box' id="Phone_input_box">
<input id='field-Phone' class='form-control' name='Phone' type='text' value="4247283035" maxlength='
11' />
</div>
<div class='clear'></div>
</div>
<div class='form-field-box even' id="Tech Id_field_box">
<div class='form-display-as-box' id="Tech Id_display_as_box">
Tech Id :
</div>
<div class='form-input-box' id="Tech Id_input_box">
<input id='field-Tech Id' class='form-control' name='Tech Id' type='text' value="2693" maxlength='6' /> </div>
<div class='clear'></div>
</div>
<div class='form-field-box odd' id="Date Issued_field_box">
<div class='form-display-as-box' id="Date Issued_display_as_box">
Date Issued :
</div>
<div class='form-input-box' id="Date Issued_input_box">
<input id='field-Date Issued' name='Date Issued' type='text' value='' maxlength='10' class='datepicker-input form-control' />
<a class='datepicker-input-clear' tabindex='-1'>Clear
</a> (dd/mm/yyyy)
</div>
<div class='clear'></div>
</div>
<div class='form-field-box even' id="Date Audited_field_box">
<div class='form-display-as-box' id="Date Audited_display_as_box">
Date Audited :
</div>
<div class='form-input-box' id="Date Audited_input_box">
<input id='field-Date Audited' name='Date Audited' type='text' value='' maxlength='10' class='datepicker-input form-control' />
<a class='datepicker-input-clear' tabindex='-1'>Clear
</a> (dd/mm/yyyy)
</div>
<div class='clear'></div>
</div>
<div class='form-field-box odd' id="Date Returned_field_box">
<div class='form-display-as-box' id="Date Returned_display_as_box">
Date Returned :
</div>
<div class='form-input-box' id="Date Returned_input_box">
<input id='field-Date Returned' name='Date Returned' type='text' value='' maxlength='10' class='datepicker-input form-control' />
<a class='datepicker-input-clear' tabindex='-1'>Clear
</a> (dd/mm/yyyy)
</div>
<div class='clear'></div>
</div>
<!-- Start of hidden inputs -->
<!-- End of hidden inputs -->
<div class='line-1px'></div>
<div id='report-error' class='report-div error'></div>
<div id='report-success' class='report-div success'></div>
</div>
<div class='buttons-box'>
<div class='form-button-box'>
<input id="form-button-save" type='submit' value='Update changes' class='ui-input-button' />
</div>
<div class='form-button-box'>
<input type='button' value='Update and go back to list' class='ui-input-button' id="save-and-go-back-button"/>
</div>
<div class='form-button-box'>
<input type='button' value='Cancel' class='ui-input-button' id="cancel-button" />
</div>
<div class='form-button-box loading-box'>
<div class='small-loading' id='FormLoading'>Loading, updating changes...
</div>
</div>
<div class='clear'></div>
</div>
</form>
</div>
</div>
<script>
var validation_url = '
http://localhost/examples/region/tor/update_validation/2';
var list_url = '
http://localhost/examples/region/tor/';
var message_alert_edit_form = "The data you had change may not be saved.\nAre you sure you want to go back to list?";
var message_update_error = "An error has occurred on saving.";
</script><script type="text/javascript">
var js_date_format = 'dd/mm/yy';
</script>
<script type="text/javascript">
var default_javascript_path = '
http://localhost/examples/assets/grocery_crud/js';
var default_css_path = '
http://localhost/examples/assets/grocery_crud/css';
var default_texteditor_path = '
http://localhost/examples/assets/grocery_crud/texteditor';
var default_theme_path = '
http://localhost/examples/assets/grocery_crud/themes';
var base_url = '
http://localhost/examples/';
</script>
</div>
</body>
</html>