IgnitedDatatables / Ignited-Datatables

Ignited Datatables is a wrapper class/library based on the native Datatables server-side implementation by Allan Jardine found at http://datatables.net/examples/data_sources/server_side.html for CodeIgniter
285 stars 335 forks source link

Shorting Searching not working in codeigniter 3.0.6 #114

Open deepesh0102 opened 8 years ago

deepesh0102 commented 8 years ago

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

view page code:-

<?php $this->load->view('includes/header'); $this->load->view('includes/left_sidebar'); $this->load->view('includes/navigation'); ?>

Basic Data Tables example with responsive plugin
First Name Last Name Email

<?php $this->load->view('includes/footer'); ?>

Controller static-content/customerlist :-

<?php

if (!defined('BASEPATH')) exit('No direct script access allowed');

/**

// 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('<span class="help-block m-b-none" style="color: red;">', '</span>');

        $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'][] = '<link rel="stylesheet" href="' . root_url() . 'asset/css/admin/plugins/dataTables/datatables.min.css" type="text/css" />';

    $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