Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorting Searching not working in codeigniter 3.0.6 #114

Open
deepesh0102 opened this issue Aug 1, 2016 · 0 comments
Open

Shorting Searching not working in codeigniter 3.0.6 #114

deepesh0102 opened this issue Aug 1, 2016 · 0 comments

Comments

@deepesh0102
Copy link

This library working on CodeIgniter version 2.1.3. Similar code not working in CodeIgniter version 3.0.6.

view page code:-

load->view('includes/header'); $this->load->view('includes/left_sidebar'); $this->load->view('includes/navigation'); ?>
Basic Data Tables example with responsive plugin
                <div class="table-responsive">
                    <table id="static_content" class="table table-striped table-bordered table-hover dataTables-example" >
                        <thead>
                            <tr>
                                <th>First Name</th>
                                <th>Last Name</th>
                                <th>Email</th>
                                
                                
                            </tr>
                        </thead>
                        <tbody>
                            
                        </tbody>
                        
                    </table>
                </div>

            </div>
        </div>
    </div>
</div>
load->view('includes/footer'); ?> <script type="text/javascript"> $(document).ready(function() { var oTable = $('#static_content').dataTable( { "bProcessing": true, "bServerSide": true, "sAjaxSource": 'static-content/customerlist', "bJQueryUI": true, "sPaginationType": "full_numbers", "iDisplayStart ":1, "oLanguage": { "sProcessing": "" }, "fnInitComplete": function() { //oTable.fnAdjustColumnSizing(); }, 'fnServerData': function(sSource, aoData, fnCallback) { $.ajax ({ 'dataType': 'json', 'type' : 'POST', 'url' : sSource, 'data' : aoData, 'success' : fnCallback }); } } ); } ); </script>

Controller static-content/customerlist :-

load->library('Datatables'); $this->load->model('Static_content_model'); } /** - script * - This function contains javascript * - - @return array */ public function script() { /\* -- Mainly scripts -- _/ $data['js_include'][] = '<script src="' . root_url() . 'asset/js/admin/inspinia.js"></script>'; $data['js_include'][] = '<script src="' . root_url() . 'asset/js/admin/plugins/pace/pace.min.js"></script>'; $data['js_include'][] = '<script src="' . root_url() . 'asset/js/admin/plugins/iCheck/icheck.min.js"></script>'; /_ */ $data['js_include'][] = '<script src="' . root_url() . 'asset/js/admin/plugins/summernote/summernote.min.js"></script>'; $data['style_include'][] = ''; $data['style_include'][] = ''; return $data; } public function add() { // var_dump($_POST); // echo $this->validate_content($this->input->post('content')); ``` $data = $this->script(); $data['title'] = 'Admin | Add Content'; if ($this->input->server('REQUEST_METHOD') === 'POST') { //Changing the Error Delimiters $this->form_validation->set_error_delimiters('', ''); $this->form_validation->set_rules('titles', 'Title', 'trim|required|min_length[3]|max_length[64]|xss_clean'); $this->form_validation->set_rules('meta_title', 'Meta title', 'trim|required|xss_clean|min_length[3]|max_length[64]'); $this->form_validation->set_rules('meta_description', 'Meta description', 'trim|required|xss_clean|min_length[5]|max_length[64]'); $this->form_validation->set_rules('meta_key', 'Meta key', 'trim|required|xss_clean|min_length[3]|max_length[128]'); $this->form_validation->set_rules('content', 'Content', 'trim|required|callback_validate_content|xss_clean'); ``` // print_r($this->input->post()); ``` $data['titles'] = $this->input->post('titles'); $data['meta_title'] = $this->input->post('meta_title'); $data['meta_description'] = $this->input->post('meta_description'); $data['meta_key'] = $this->input->post('meta_key'); $data['content'] = $this->input->post('content'); ``` // print_r($data); exit; ``` if ($this->form_validation->run() == true) { $dataArray['title'] = $this->input->post('titles'); $dataArray['meta_title'] = $this->input->post('meta_title'); $dataArray['meta_description'] = $this->input->post('meta_description'); $dataArray['meta_key'] = $this->input->post('meta_key'); $dataArray['content'] = htmlspecialchars($this->input->post('content')); ``` // $userInfo = $this->user_model->isExitsEmail($this->input->post('email')); ``` $dataArray['modify_date'] = date('Y-m-d h:i:s'); $this->Static_content_model->addContent($dataArray); $data['success_message'] = 'Content Added Successfuly!'; ``` // print_r($data); exit; // mail } else { ``` $data['error_message'] = 'Content Not Added , please try again!'; } } ``` // print_r($data); ``` $this->load->view('static_content/static_content_form', $data); } public function edit() { $content_id = $this->uri->segment(3); $getdata = $this->Static_content_model->editContent($content_id); $data = $this->script(); $data['title'] = 'Admin | Edit Content'; $data['titles'] = $getdata['title']; $data['meta_title'] = $getdata['meta_title']; $data['meta_description'] = $getdata['meta_description']; $data['meta_key'] = $getdata['meta_key']; $data['content'] = $getdata['content']; ``` // $string = $this->parser->parse('static_content/static_content_form', $data); $this->load->view('static_content/static_content_form', $data); } ``` public function delete() { } /** * Validate String empty or not removing html tags * * @param string * @return boole */ public function validate_content($content) { $fillter_string = strip_tags($content); if (empty($fillter_string)) { $this->form_validation->set_message('validate_content', 'The {field} field is required.'); return FALSE; } else { return TRUE; } } /** * View Static Content Function * */ public function view() { $data['title'] = 'Admin | View Content'; /* -- Mainly scripts -- */ $data['js_include'][] = '<script src="' . root_url() . 'asset/js/admin/plugins/dataTables/datatables.min.js"></script>'; $data['style_include'][] = ''; $this->load->view('static_content/static_content_view', $data); } /** * @customerlist Function * @return Json */ public function customerlist() { $this->datatables->select('customer_id,first_name,last_name,email') ->unset_column('customer_id') ->from('customers'); echo $this->datatables->generate(); } public function static_content_list() { $this->datatables->select('content_id,title,add_date,modify_date,staus') ->from('static_content'); echo $this->datatables->generate(); } ``` } shorting searching not working
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant