Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
ERROR showing data
21/01/2014
16:16
Avatar
overbrain
New Member
Members
Forum Posts: 1
Member Since:
21/01/2014
sp_UserOfflineSmall Offline

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.

problem here

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>

24/01/2014
20:42
Avatar
Lonewolf217
Member
Members
Forum Posts: 32
Member Since:
22/05/2013
sp_UserOfflineSmall Offline

The sample page you have doesn't work.  i dont know if it has been modified since your original post, but if you look at the console in your browser you see errors like this which are causing the javascript to exit prematurely and not display anything. 

Failed to load resource: the server responded with a status of 404 (Not Found) http://importadores.scc.com.pt.....custom.css
Uncaught TypeError: Cannot read property 'safari' of undefined grid.loader.js:29
Uncaught SyntaxError: Unexpected token {
Forum Timezone: Europe/Sofia

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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information