1

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?

2
  • Can you edit the post and add the view for welcome_message.php ? It seems that your issue is at the view. Commented Jun 30, 2014 at 6:39
  • have you written output() function in your controller ? Commented Jun 30, 2014 at 9:09

1 Answer 1

2

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 :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.