Hi guys,
i'm new to grocery crud and some buttons aren't working. I found many solutions for my problem but nothing worked for me.
My Controller looks like this:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class System_administration extends CI_Controller { /** * Constructor. */ function __construct( ) { parent::__construct( ); $this->data = array('header' => array('title' => ''), 'top_nav' => array(), 'content' => array(), 'footer' => array() ); $this -> load -> library( 'grocery_CRUD' ); }//__construct() public function court() { $name = $this->session->userdata( 'name' ); $user = $this -> user_model -> get_by( array( 'name' => $name ) ); $table_court = new grocery_CRUD(); $table_court->set_subject('Tennisplätze'); $table_court->set_table('tb_court'); $table_court->add_fields( 'name', 'status', 'surface_id' ); $table_court->edit_fields( 'name', 'status', 'surface_id' ); $table_court->required_fields( 'name', 'status', 'surface_id' ); $table_court->set_relation('surface_id','tb_surface','name'); $table_court->display_as('name','Platzname'); $table_court->display_as('surface_id','Platzbelag'); //$table_court->unset_jquery(); //$table_court->unset_jquery_ui(); $table_court_output = $table_court->render(); $this->data['header']['css_files'] = $table_court_output->css_files; $this->data['top_nav']['user'] = $user; $this->data['footer']['js_files'] = $table_court_output->js_files; $this->data['footer']['js_lib_files'] = $table_court_output->js_lib_files; $this->data['footer']['js_config_files'] = $table_court_output->js_config_files; $this->data['content']['table_court'] = $table_court_output; $this->template->set('header', 'all/header', $this->data['header']); $this->template->set('top_nav', 'admin/top_nav', $this->data['top_nav']); $this->template->set('content', 'admin/system_administration/court', $this->data['content']); $this->template->set('footer', 'all/footer', $this->data['footer']); $this->template->load('template'); } }
My footer:
<?php if( isset( $js_files ) ): ?> <?php foreach($js_files as $file): ?> <script type="text/javascript" language="JavaScript" src="<?php echo $file; ?>?158"></script> <?php endforeach; ?> <?php endif; ?> </body> </html>
and my Header:
<!DOCTYPE html> <html lang="de"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title><?php echo $title; ?></title> <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrap.min.css" type="text/css" media="screen"> <link rel="stylesheet" href="<?php echo base_url(); ?>assets/css/bootstrap-theme.min.css" type="text/css" media="screen"> <?php if( isset( $css_files ) ): ?> <?php foreach( $css_files as $file ): ?> <link type="text/css" rel="stylesheet" href="<?php echo $file; ?>?122" /> <?php endforeach; ?> <?php endif; ?> </head> <body>
The dategrid loads fine. Delete, Print, Export etc. works perfect.
The "Save and go back to list"- and "Cancel"-Button aren't working at all. The "Save"-Button works (it performs the database action) and then it shows the message:
{"success":true,"insert_primary_key":5,"success_message":"
Your data has been successfully stored into the database. Edit Tennispl\u00e4tze<\/a> or Go back to list<\/a><\/p>","success_list_url":"http:\/\/127.0.0.1:4001\/tennisbase\/index.php\/admin\/system_administration\/court\/success\/5"}
I think there is a problem with javascript.. but where?
I hope that someone can help me and sorry for my english ;)
Kind regards,
Damasus