1
votes

I'm using Codeigniter + Grocery Crud. So, GC working good but is blank.. shows results from database, but search option and css style doesn't load. My structure is:

  • application

  • assets

  • system

    GC is inside assets.

My controller load view and send output to view:

public function output($output = null) {
    $this->load->view('welcome_message', $output);
}

public function users() {
    $this->load->library('grocery_CRUD');
    $this->output((object) array('output' => '', 'js_files' => array(), 'css_files' => array()));

    try {
        $crud = new grocery_CRUD();

        $crud->set_theme('flexigrid');
        $crud->set_table('suppliers');
         
        $output = $crud->render();
        
        $this->output($output);
    } catch (Exception $e) {
        show_error($e->getMessage() . ' --- ' . $e->getTraceAsString());
    }

}

After that, i'm using CG official tutorial to include jQuery and CSS files in the view. They are there. When i click over (in view source) - i can see them. It's not problem in folders. I saw in View source double html tags... Is it exist any codeigniter autoload library to do that?

I'm defined autoload helpers - url and utility, which i made for loading assets folder.

I'm supposing the problem is ajax, jquery...but how to fix it?

1
Can you edit the post and add the view for welcome_message.php ? It seems that your issue is at the view. - John Skoumbourdis
have you written output() function in your controller ? - kasim badami

1 Answers

2
votes

Grocery CRUD output contains an array for adding java-script files

If you want to add extra/custom js file then you have to do something like this:

$output = $crud->render();          
array_push($output->js_files, base_url("assets/my_js_folder/myjs.file.js")); 
array_push($output->js_files, base_url("assets/another_js/config.module.js")); 
$this->output($output);

I really hope this help you :)