Forum
16:16
21/01/2014
hello everyone
I am using jqgrid for the first time I'm doing some tests but I came across an error that still could not solve, the data in Table I show off the grid can help me?
I'll put here the code of php and html.
thank you
and sorry for bad english
<?php
require_once 'jq-config.php';
// include the jqGrid Class
require_once ABSPATH."php/jqGrid.php";
// include the driver class
require_once ABSPATH."php/jqGridPdo.php";
// Connection to the server
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
// MySQL specific command for the charset
// Tell the db that we use utf-8
$conn->query("SET NAMES utf8″);
// Create the jqGrid instance
$grid = new jqGridRender($conn);
// Data from this SQL is 1252 encoded, so we need to tell the grid
// Set the SQL Data source
$grid->SelectCommand ='SELECT id, nome, nif, contacto, transitario, user, arc, metodo, copia, motivo, changed_on, envia FROM importador';
// set the ouput format to XML
$grid->dataType = 'json';
//$Model = array(
// array("name"=>"id","width"=>40,"editable"=>false),
// array("name"=>"nome","editable"=>true)
// );// Let the grid create the model
$grid->setColModel();
//$grid->setColModel($Model);//$mylabels = array(
//"id"=>"Id", //"nome"=>"Nome",
//"morada"=>"Morada",
//"nif"=>"Nif",
//"contacto"=>"Contacto",
//);// set labels in the header
$grid->setColProperty("id", array("label"=>"ID") );
$grid->setColProperty("nome", array("label"=>"NOME"));
$grid->setColProperty("morada", array("label"=>"MORADA"));
$grid->setColProperty("nif", array("label"=>"NIF"));
$grid->setColProperty("contacto", array("label"=>"CONTACTO"));
$grid->setColProperty("transitario", array("label"=>"TRANSITARIO"));
$grid->setColProperty("user", array("label"=>"USERNAME"));
$grid->setColProperty("arc", array("label"=>"ARC"));
$grid->setColProperty("metodo", array("label"=>"METODO"));
$grid->setColProperty("copia", array("label"=>"ANEXOS"));
$grid->setColProperty("motivo", array("label"=>"MOTIVO"));
$grid->setColProperty("changed_on", array("label"=>"D/CRIACAO"));
$grid->setColProperty("envia", array("label"=>"STATUS"));// We can hide some columns
//$grid->setColProperty("changed_on", array("hidden"=>true));
//$grid->setColProperty("motivo", array("hidden"=>true));// Set the url from where we obtain the data
$grid->setUrl('myjqgridphp.php');
// Set some grid options
$grid->setGridOptions(array("rowNum"=>20,"rowList"=>array(20,40,80),"sortname"=>"id","height"=>150));
// Enable toolbar searching
$grid->toolbarfilter = true;
$grid->setFilterOptions(array("stringResult"=>true));
// Enjoy
$grid->renderGrid('#grid','#pager',true, null, null, true,true);
$conn = null;
?>
<?php
//require_once 'tabs.php';
ob_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>jqGrid PHP Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8″ /><head><link rel="stylesheet" type="text/css" media="screen" href="excite-bike/jquery-ui.custom.css"/>
<link rel="stylesheet" type="text/css" media="screen" href="themes/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="themes/ui.multiselect.css" />
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script type="text/javascript">
$.jgrid.no_legacy_api = true;
$.jgrid.useJSON = true;
</script>
<script src="js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="themes/jquery-ui.custom.min.js" type="text/javascript"></script>
<script src="js/src/grid.loader.js" type="text/javascript"></script>
</head>
<body>
<div>
<?php include("myfirstgrid.php");?></div>
<br/>
</body>
</html>
Most Users Ever Online: 715
Currently Online:
71 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66