Hello, I'm trying to integrate with codeigniter so:
Controller:
<?php
class Segway extends MY_Controller
{
function __construct()
{
parent::__construct();
if (!$this->loggedIn) {
$this->session->set_userdata('requested_page', $this->uri->uri_string());
$this->sma->md('login');
}
if (!$this->Owner && !$this->Admin) {
$this->session->set_flashdata('warning', lang('access_denied'));
redirect($_SERVER["HTTP_REFERER"]);
}
}
public function index()
{
// $this->load->view('welcome_message');
require_once(APPPATH. 'libraries/phpgrid/config.php'); // APPPATH is path to application folder
// Database config file to be passed in phpgrid constructor
$db_conf = array(
"type" => PHPGRID_DBTYPE,
"server" => PHPGRID_DBHOST,
"user" => PHPGRID_DBUSER,
"password" => PHPGRID_DBPASS,
"database" => PHPGRID_DBNAME
);
$g = new jqgrid($db_conf);
$grid["caption"] = "Sample Grid";
$g->set_options($grid);
$g->table = "clients";
$out = $g->render("list1");
$this->load->view('show_grid',$out);
}
?>
View:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Show Grid</title>
</head>
<body>
<div id="container">
<h1>Welcome to CodeIgniter! Show me the grid!</h1>
<div id="body">
<?php echo $out?>
</div>
</div>
</body>
</html>
I have used tutorial to try to integrate it:
But not works; Thanks by your help!
Sorry I'll try with:
https://gist.github.com/gridphp/272a3063359c8b5938355ed59c7711d4
Thank you!
I did it, but show me error:
Unable to load the requested file: default.php
Thanks by your help!
Hello,
Make sure file is correct and always check php error log for error details. There could be more than one reasons for this.
Hello Abu,
It's working partially, just because says grid message: No records to view
But i have records here in clients table.
Regards!