Forum


22:24

21/05/2009

I downloaded all files (jgrid and jgrid_demo) and followed the instructions. But I cound't make it work. Here my codes:
roteiros.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link rel="stylesheet" type="text/css" media="screen" href="jquery_plugins/jqGrid/themes/basic/grid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="jquery_plugins/jqGrid/themes/jqModal.css" />
<script src="jquery/jquery.js" type="text/javascript"></script>
<script src="jquery_plugins/jqGrid/jquery.jqGrid.js" type="text/javascript"></script>
<script src="jquery_plugins/jqGrid/js/jqModal.js" type="text/javascript"></script>
<script src="jquery_plugins/jqGrid/js/jqDnR.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#list").jqGrid({
url:'dados_roteiro.php',
datatype: 'xml',
mtype: 'GET',
colNames:['Chave','Titulo', 'Descricao','Data de Partida','Data de Retorno'],
colModel :[
{name:'rot_chave_primaria', index:'rot_chave_primaria', width:55},
{name:'rot_titulo', index:'rot_titulo', width:90},
{name:'rot_descricao', index:'rot_descricao', width:80, align:'right'},
{name:'rot_periodo_inicial', index:'rot_periodo_inicial', width:80, align:'right'},
{name:'rot_periodo_final', index:'rot_periodo_final', width:80, align:'right'},
pager: jQuery('#pager'),
rowNum:10,
rowList:[10,20,30],
sortname: 'Chave',
sortorder: "DESC",
viewrecords: true,
imgpath: 'jquery_plugins/jqGrid/themes/basic/images',
caption: 'Roteiros Cadastrados'
});
});
</script>
</head>
<body>
<table id="list" class="scroll">
</table>
<div id="pager" class="scroll" style="text-align:center;">
</div>
</body>
</html
the xml:
<?xml version="1.0" encoding="utf-8"?>
<rows>
<page> </page>
<total> </total>
<records> </records>
<row id = "unique_rowid">
<cell> cellcontent </cell>
<cell> <![CDATA[<font color="red">cell</font> content]]> </cell>
…
</row>
<row id = "unique_rowid">
<cell> cellcontent </cell>
<cell> <![CDATA[<font color="red">cell</font> content]]> </cell>
…
</row>
…
</rows>
and the php file (dados_roteiro.php):
<?php
include ("functions.php");
conexao();
sessao();
?>
<?php
$page = $_GET['page'];
$limit = $_GET['rows'];
$sidx = $_GET['sidx'];
$sord = $_GET['sord'];
$result = mysql_query("SELECT COUNT(*) AS count FROM tur_roteiros");
$row = mysql_fetch_array($result,MYSQL_ASSOC);
$count = $row['count'];
if( $count > 0 ) {
$total_pages = ceil($count/$limit);
} else {
$total_pages = 0;
}
if ($page > $total_pages) $page=$total_pages;
$start = $limit*$page - $limit;
if($start <0) $start = 0;
$SQL = "SELECT rot_chave_primaria, rot_titulo, rot_descricao, rot_valor, rot_periodo_inicial, rot_periodo_final FROM tur_roteiros ORDER BY \\"{$sidx}\\" \\"{$sord}\\" LIMIT 0 , 10";
$result = mysql_query( $SQL ) or die("Couldn't execute query.".mysql_error());
// we should set the appropriate header information
/*if ( stristr($_SERVER["HTTP_ACCEPT"],"application/xhtml+xml") ) {
header("Content-type: application/xhtml+xml;charset=utf-8");
} else {
header("Content-type: text/xml;charset=utf-8");
}*/
echo "<?xml version='1.0' encoding='utf-8'?>";
echo "<rows>";
echo "<page>".$page."</page>";
echo "<total>".$total_pages."</total>";
echo "<records>".$count."</records>";
while($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
echo "<row id='". $row['rot_chave_primaria']."'>";
echo "<cell>". $row['rot_titulo']."</cell>";
echo "<cell><![CDATA[". $row['rot_descricao']."]]></cell>";
echo "<cell>". $row['rot_valor']."</cell>";
echo "<cell>". $row['rot_periodo_inicial']."</cell>";
echo "</row>";
}
echo "</rows>";
?>
Every time I load tthe roteiro.html page, I get a blue <div> with nothing inside. The jgrid_demo doesn't work either. How do the $_GET parameters are passed to the url (dados_roteiro.php)? How do I put it to work?
Thanks
Most Users Ever Online: 715
Currently Online:
51 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